Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2003
    Posts
    37

    Unanswered: Passing SQL Parameter

    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.

  2. #2
    Join Date
    Jul 2003
    Location
    Melbourne
    Posts
    3

    Arrow Re: Passing SQL Parameter

    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,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •