Access to Result sets from within Stored procedures Transact-SQL SQL Server

前端 未结 7 1139
栀梦
栀梦 2020-11-27 17:59

I\'m using SQL Server 2005, and I would like to know how to access different result sets from within transact-sql. The following stored procedure returns two result sets, ho

相关标签:
7条回答
  • 2020-11-27 18:34

    There are two ways to do this easily. Either stick the results in a temp table and then reference the temp table from your sproc. The other alternative is to put the results into an XML variable that is used as an OUTPUT variable.

    There are, however, pros and cons to both of these options. With a temporary table, you'll need to add code to the script that creates the calling procedure to create the temporary table before modifying the procedure. Also, you should clean up the temp table at the end of the procedure.

    With the XML, it can be memory intensive and slow.

    0 讨论(0)
提交回复
热议问题