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!

Stored Procedure Recordset

Status
Not open for further replies.

AccessSQLUser

Programmer
Apr 23, 2001
101
US
How do you select only specific records from those returned from a stored procedure?
Here's an idea of what I want:
Select *
from storedprocedure
Where
column1='x'
 
Here are two options:

1- Modify the SP to include a selection criteria. Then call the SP with a parameter.
exec storedprocedure 'x' OR exec storedprocedure @param

2- Call the SP from another SP that places the results of the called SP into a temporary table and select rows from there.

Create Table #tbl (column1 char(1),column2 type, ....)

Insert #tbl
Exec storedprocedure

Select * From #tbl Where column1='x'

Drop table #tbl


Good luck. Terry
 
Thanks. I think I'll have to go with the second option. What I would really like to do is convert my stored procedure to a user-defined function so that way I don't have to create a temp table and all that. The problem is that in an in-line table-valued function, you can only have a select statement and you can't declare or set variables so that won't work for me. Oh well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top