[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.sqlserver.programming

Returning Data From One SP to another SP

S Chapman

3/30/2007 10:59:00 AM


I have a stored procedure that executes a dynamic sql and returns
rows. The structure of the results can vary (i.e. the columns returned
are not fixed).

I have a second stored procedure that woud need data returned by the
first stored procedure but I can't figure out how I can receive the
data from the first procedure in the second.

I tried EXEC SP_1 INTO #Temp - didn't work.

Any help greatly appreciated. Thanks.

1 Answer

Roy Harvey

3/30/2007 11:11:00 AM

0

Do not name your stored procedures with the prefix sp_. Names of that
form have special properties that are not appropriate for application
processes.

To save data returned from a stored procedure you have to INSERT it
into an already existing table:

INSERT #Temp
EXEC SP_1.

However, from your description you do not know what is coming back. As
you are discovering, SQL is not a tool for working with undefined
data.

What I do not understand is how the second stored procedure could
possibly do anything useful when it does not know what data it is
supposed to be receiving.

At any rate, it appears to me that you have painted yourself into a
corner. Good luck!

Roy Harvey
Beacon Falls, CT

On 30 Mar 2007 03:59:02 -0700, "S Chapman" <s_chapman47@hotmail.co.uk>
wrote:

>
>I have a stored procedure that executes a dynamic sql and returns
>rows. The structure of the results can vary (i.e. the columns returned
>are not fixed).
>
>I have a second stored procedure that woud need data returned by the
>first stored procedure but I can't figure out how I can receive the
>data from the first procedure in the second.
>
>I tried EXEC SP_1 INTO #Temp - didn't work.
>
>Any help greatly appreciated. Thanks.