Thursday, March 24, 2011

Share table variable between Stored procedure in SQL Server

Is it possible to store the results of a call to exec sp_executesql in a 'table parameter'. The parameter value is used in another SQL Stored procedure (SQL 2000/2005)

From stackoverflow
  • Best you can do is insert the values into a temp table (using an INSERT EXEC pattern) and then use that temp table in the second proc down the chain ...

  • If you are wanting to store the results of some process in a table variable, I would suggest making it a table-value function instead of a sproc. That way you can then use the end-result of the first function in whatever other processing you are doing

    Select * from MyTableValueFunction()
    

0 comments:

Post a Comment