General information
Forum:
Microsoft SQL Server
Title:
Why does this not work in sproc but in query analyzer ???
In QA I can put in the following:
SET QUOTED_IDENTIFIER OFF
DECLARE @pForm_Id NVARCHAR(50),
@tsql1 NVARCHAR(4000)
SET @pForm_ID = 'TEST_FORM_01' --This will be a param in the sproc
SET @tsql1 = 'SELECT lbl_text FROM MetaLabel WHERE lbl_frm_id = ' + "'" + @pFrm_id + "'"
EXEC (@tsql1)
This works fine above in QA, but if I put the same in an sproc I can't even save it because of 'Invalid column "' message.
If I try 'lbl_frm_id = ' + @pFrm_Id gives me "TEST_FORM_01" is not a valid column when I run the sproc, however this will let me save the sproc.
I have had stuff like this run fine before and I'm even cutting and pasting old code over that is indentical to this that works fine, but for some reason I can't even save the sprocs.
Any clues ???
TIA !!!
Jace
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only