Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dynamic SQL question
Message
From
16/07/2002 03:37:07
Paul Johns
Millrise Solutions Ltd
Scunthorpe, United Kingdom
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00675839
Message ID:
00678984
Views:
12
I think whats happening is the exec function doesn't know what the variable means. If you enclosed the declare statement within the exec the statement it would probably execute. You would however not be able to use the result as it think it would be destoryed upon completion. The only way i can think of working round this is to output the result into a global temp table using a select into (if permitted on you sql sqrver check options!!). The result could then be read by a simple

select @variable = field1 from ##temptable.

Ive noticed that the thread is quite old so if you have already solved this accept my appologies.
Previous
Reply
Map
View

Click here to load this message in the networking platform