I set up successfully the ability to execute a stored procedure on a second SQL Server from a first SQL Server. I understand that I can pass parameters from procedure to procedure... however, I do not know how to pass a sql statement result set as a parameter to another procedure for that second procedure to use. Can anyone give me an example of doing this?
So maybe an example to show proc1 performing the query 'select name, city from tblcustomer', storing the results of that procedure in a parameter say @.resultset and proc2 creating a table of the results stored in @.resultset.
Thats a pretty basic example and will help me get started on this massive parameter passing that I have to do.Originally posted by justastef
I set up successfully the ability to execute a stored procedure on a second SQL Server from a first SQL Server. I understand that I can pass parameters from procedure to procedure... however, I do not know how to pass a sql statement result set as a parameter to another procedure for that second procedure to use. Can anyone give me an example of doing this?
So maybe an example to show proc1 performing the query 'select name, city from tblcustomer', storing the results of that procedure in a parameter say @.resultset and proc2 creating a table of the results stored in @.resultset.
Thats a pretty basic example and will help me get started on this massive parameter passing that I have to do.
One way could be using system stored procedure Sp_Executesql and executing your query and have a resultset returned to you in a Table data type and then you can use that to pass it as a parameter to the second stored procedure.
HTH,
No comments:
Post a Comment