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 |
|
Hommer
Aged Yak Warrior
808 Posts |
Posted - 2007-05-29 : 17:21:48
|
| Hello, All,How to feed a returned recordset from a stored proc into a t-sql select statement? I have seen example of getting a single integer value, or using an output param in the sp to return data.In my case, I cannot change to sp to make it use output param. So, normally here is how it returnsexec mySP @inputIDand my t-sql normally look like thisSELECT * into #mytmpTable from mytable where ID = @inputIDNow I want to switch the above FROM to from my stored proc, and the following two ways failed.Exce #mytmpTable = mySP @inputIDorSelect * into #mytmpTable Exec mySP @inputID(Must specify table to select from)Thanks!By the way, I am using sql2000. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-05-29 : 17:30:35
|
| You must first create the temp table, then put the results into it using insert into ... exec ...Tara Kizerhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
Hommer
Aged Yak Warrior
808 Posts |
Posted - 2007-05-29 : 17:51:29
|
| Great, thanks! |
 |
|
|
|
|
|