May 17, 2004 at 5:03 pm
I have a stored procedure and I like to call this from select script.
This stored procedure returns a record with one column wichi is a recordset by select command inside.
How to call a stored procedure like below:
select ID, (exec sp_return_name_recordset 1000) as name
from nameTable
where nameTable.ID='1000'
Stored procedure accepts ID and returns a records of name value.
how to combine select and stored procedure record in one record?
May 17, 2004 at 8:19 pm
Errrr.... not sure just exactly what you're looking for so I offer this simple example on how to use a rowset from a stored procedure....
USE PUBS
GO
SELECT a.*
FROM OPENROWSET('MSDASQL',
'DRIVER={SQL Server};SERVER=seattle1;UID=sa;PWD=MyPass',
'EXEC SP_COLUMNS AUTHORS') AS a
--Jeff Moden
Change is inevitable... Change for the better is not.
May 18, 2004 at 12:54 am
Use a Function:
select ID, dbo.fn_return_name_recordset(ID) as name
from nameTable
where nameTable.ID='1000'
/rockmoose
You must unlearn what You have learnt
May 18, 2004 at 10:30 am
if you are using vb or asp..then use a executecommand on the stored procedure. This will return a recordset
Hope that helps.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply