Home Forums SQL Server 2008 T-SQL (SS2K8) Store result of stored procedure into a xml/nvarchar(max) variable RE: Store result of stored procedure into a xml/nvarchar(max) variable

  • Andrew in WV (6/21/2012)


    ColdCoffee (2/16/2012)


    THere is something called as Output Parameters while defining a Stored Procedures. Thats what you are looking for .

    Here is the link : CREATE PROCEDURE

    To be precise, Example C in Passing Parameters is what you are after!

    OK, I'm going to interject here. I realize the OP has probably moved on given that this exchange was a few months ago, but I am looking for the same thing. While they MAY have been a suitable option for the OP, they are NOT suitable for what I need to do and therefore it is quite possible that they are not what the OP was looking for either.

    I have a similar situation where I need to compare the results of two stored procedures that return results using FOR XML EXPLICIT. While there are other ways to approach the problem in my case (I'm doing acceptance testing to verify the correctness of a new, more efficient and performant version of an existing procedure since the original is horribly inefficient) the ability to assign the results of each procedure to a variable for comparison would make things much simpler since in my case I am doing this using SQL 2K and the EXCEPT/INTERSECT statements are not available.

    What the OP asked for may not be possible, but it is not really correct to just assume that he/she is looking for output parameters when those might not be suitable for his/her case at all.

    You may get a better/faster answer posting an original thread in a forum not specific to 2008? (Sorry that I'm not providing an actual answer for you.)