I am trying to create a string dynamically and then get it executed. My problem is that the string may be 100 chars long or up to 600 chars. I can get the sql to create the srting in the correct syntax. I have used a very simple of select in order to make it easy
my problem is that the code below Parses Ok but when I execute it says
Msg 2812, Level 16, State 62, Line 5
Could not find stored procedure 's'.
This is confusing as I am not trying to create a SP
Also, is there specific syntax that I am missing
Any ideas please
Thanks from the novice
declare @string as varchar
set @string = 'select * from [dbo].[expenseheader]'