Search code examples
sql-servert-sqlstored-proceduresmultiple-resultsets

sql stored procedure clear resultsets


Can I clear the multiple result sets that a stored procedure has already gathered so that the next result set that is created becomes the very first result set returned by the procedure?


Solution

  • this would depend on the Database. In Sql Server, once the result set is sent, it is gone. The receiving application/code must deal with it. If you need to have logic like this, gather the results into a temp table and only return what is needed at the end of the procedure.