i have this stored proc that accepts a parameter called @spParam which is of type char(40) and i have a variable called @SQL_TEXT which holds a select stmt 'select prog_NAME from tblArea where area = '
This select stmt btw is stored in a table that i am retrieving in the SP.
when i try to execute it using this code:
SELECT @SQL_TEXT = @SQL_TEXT + @spParam
EXEC(@sql_text)
i get this error message:
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near 'AREA'.
i have a feeling it has soemthing to do with singe quotes - can anyone advise as to how i can go about fixing.
thanks
This select stmt btw is stored in a table that i am retrieving in the SP.
when i try to execute it using this code:
SELECT @SQL_TEXT = @SQL_TEXT + @spParam
EXEC(@sql_text)
i get this error message:
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near 'AREA'.
i have a feeling it has soemthing to do with singe quotes - can anyone advise as to how i can go about fixing.
thanks