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 |
vishu.av
Starting Member
26 Posts |
Posted - 2007-04-23 : 05:13:08
|
Hi All,Can i run a stored procedure with in a SELECT statementlike below?Select * from EmployeeDetails where EmployeeName in (.. Some Stored procedure to return me some set of Employee Names)Is there a better way of doing it?Thanks in advancevishuBangalore |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-04-23 : 05:16:26
|
No, you can not.But... You can store the result of an SP in a temp tableINSERT #TempEXEC <SP>and use the table with a JOIN as normal.Peter LarssonHelsingborg, Sweden |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-04-23 : 05:19:12
|
Not directly.You can store the output of Stored Proc in a temp table like:Create table #temp(... -- define columns here)Insert into #tempEXEC sp_something(...) And then use temp table in SELECT statement like below:Select ed.* from EmployeeDetails ed Join #temp t on ed.EmployeeName = t.EmployeeName PesoBot again overtook me!Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
|
|
|
|
|