-
Ok, but how do I assign that to a variable
Thats great the EXEC('some query') works just fine, but how do I get the results of that query back into a variable? For example I can:
DECLARE @var varchar(50)
EXEC('SELECT @col_name FROM TABLE WHERE CONDITION = whatever')
but It won't let me do something like
SELECT @var2 = EXEC(@some_query)
or
SELECT @var2 = Select top 1* from (EXEC (@some_query))
I need to get the results of that query back into a program variable @variable. How do I do that?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|