Dhanapal
Dhanapal

Reputation: 14507

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)

Upvotes: 0

Views: 2646

Answers (2)

TheTXI
TheTXI

Reputation: 37885

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()

Upvotes: 0

Sam Saffron
Sam Saffron

Reputation: 131112

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 ...

Upvotes: 2

Related Questions