Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using stored procedures in select query

Status
Not open for further replies.

amolk

Programmer
Apr 29, 2001
1
IN
is there any way to use stored procedures as subqueries?
something like select * from tablename where column1value=xxx and column2value in ( exec procname, parameter1, paramter2 )

if not, any workaround?
thnx
amol
 
You can't use a stored procedure in a select query but you can use the following work around.

Create Table #TmpTbl (ColA datatype)
Insert #TmpTbl
Exec MySP param1,param2 /* Insert results of SP into #TmpTbl */
Select * From tablename Where col1=xxx and col2 In (Select ColA From #TmpTbl)
.
. Additional processing
.
Drop #TmpTbl Terry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top