A stored procedure using following dynamic sql
--declare @Dictionaryvarchar(128) = 'Test'--declare @Stringvarchar(1000)='Test1'
select @String = "select 202,'" + @Dictionary + "','Value',
DictionaryIndex, Value,SeqNo
from " + @Dictionary + "
order by SeqNo"
--print (@String)
When i drop and recreate stored procedure it creates it successfully. But i if try to print the script above it gives error
Msg 207, Level 16, State 1, Line 5Invalid column name 'select 202,''.
Msg 207, Level 16, State 1, Line 5
Invalid column name '','Value',
DictionaryIndex, Value,SeqNo
from '.
Msg 207, Level 16, State 1, Line 7
Invalid column name '
order by SeqNo'.