Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
lane0618
Posting Yak Master
134 Posts |
Posted - 2002-05-21 : 13:05:41
|
| The following code is part of a sp. When it is run I get the error: Invalid column name 'lpp'.I don't know if I'm missing something fairly obvious but I can't seem to figure it out. 'lpp' is the criteria I've given @sqldesc. I don't know why its looking for a column.@sqldesc is an input parameter@blah returns a single quote@csvItem is a comma seperated list used for the IN statement.declare @where varchar(8000)set @where = 'where p1.desc1 like ' + @sqldesc + ' and p1.item in' + '(' + @blah + @csvItem + @blah + ')'declare @fqry varchar(8000)select @fqry = 'SELECT P1.ITEM, P2.PTDRAW, P1.DESC1, P1.STATUS, P1.PTDRAW AS mfg_draw, left(p1.item,5) as item_5dFROM mfgpro.dbo.[ANA No Dups] P1 INNER JOIN mfgpro.dbo.[ANA No Dups] P2 ON LEFT(P1.ITEM, 5) + ' + @blah + '-000' + @blah + ' = P2.ITEM ' select @fqry= @fqry + @whereexec (@fqry)GO |
|
|
setbasedisthetruepath
Used SQL Salesman
992 Posts |
Posted - 2002-05-21 : 13:11:27
|
| what you need to do is PRINT the resulting @frqy before the exec() to see what's going on. you'll see the problem right away, i suspect.setBasedIsTheTruepath<O> |
 |
|
|
lane0618
Posting Yak Master
134 Posts |
Posted - 2002-05-21 : 13:17:30
|
| That did the trick!!Thanks! |
 |
|
|
|
|
|