September 5, 2005 at 4:17 am
Hi all,
I execute a stored procedure that returns some rows.
for example:
DBCC INPUTBUFFER(54)
now I want to deal with the returned rows as I deal with the rows returned from a view or table.
for example: I want to join the rows from the stored procedure with other tables.
September 5, 2005 at 4:51 am
You'll need to create a table (normally a temp table) to hold the results. It must have the same number of columns, with correct datatypes and in the right order, as the output of the statement.
Then do something like this:
INSERT INTO #results
EXEC ('DBCC INPUTBUFFER(54)')
September 5, 2005 at 5:50 am
Conversely, you may want to review using a UDF that returns data that you can use i.e. SELECT * FROM dbo.udf_TableReturn.....
Good Hunting!
AJ Ahrens
webmaster@kritter.net
September 5, 2005 at 6:22 am
THANK YOU.
but what if I want to pass parameters to stored procedures?
Dear AJ Ahrens,
I didn't get what exactly u mean, can u give me more explanation please?
September 5, 2005 at 6:31 am
THANK YOU.
but what if I want to pass parameters to stored procedures?
here's the answer (really simple question):
INSERT INTO #INPUTBUFFER_SRC EXEC('DBCC INPUTBUFFER(' + @SPID + ')')
September 5, 2005 at 1:44 pm
Ahmed,
You can find more information about UDFs in BOL (Books online), here at SQLServerCentral.com, on the web etc..
Basically you create a FUNCTION that can accept parameters and RETURNS a TABLE based on your PARAMETERS. It works similarly to a SP (not exactly).
Should help you.
Good Hunting!
AJ Ahrens
webmaster@kritter.net
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply