Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
jcmajewski
Starting Member
2 Posts |
Posted - 2003-12-11 : 12:49:11
|
| How do I get a value out of an EXEC Statement? I'm looking to put the INT that the EXEC returns into a local variable. |
|
|
ehorn
Master Smack Fu Yak Hacker
1632 Posts |
Posted - 2003-12-11 : 13:02:00
|
| [code]create proc up_output @output int outputasset @output = 1godeclare @out intexec up_output @out outputselect @outgodrop proc up_output[/code]http://www.sqlteam.com/item.asp?ItemID=2644 |
 |
|
|
jcmajewski
Starting Member
2 Posts |
Posted - 2003-12-11 : 13:17:44
|
| I'm having trouble applying your response to my problem.I have a select statement inside of a and exec:EXEC ("SELECT [some_value] FROM [some_table] WHERE " + @some_conditions)and i'm trying to get the result of that exec into another variable.How would do that? |
 |
|
|
ehorn
Master Smack Fu Yak Hacker
1632 Posts |
Posted - 2003-12-11 : 13:22:25
|
I am sorry. I misread your problem.You could perform an insert into a temp table and retrieve the value from that. Variables are out of scope for Dynamic SQL though.create table #value (some_value int)insert into #value exec('SELECT [some_value] FROM [some_table] WHERE [some_conditions]')select * from #valuedrop table #value |
 |
|
|
|
|
|