You cannot pass a table variable to a stored procedure. SQL BOL states, "All data types, except the table data type, can be used as a parameter for a stored procedure." Terry L. Broadbent - DBA
Computing Links:
Ok, so you can't send a variable of type TABLE to a stored procedure, but is there any way to send a result set to a stored procedure? This would be very useful for my median calculations. MYenigmaSELF:-9 myenigmaself@myenigmaself.gaiden.com
I wanted to pass a result set TO a stored procedure. I've since found that this is impossible. Thanks anyway. MYenigmaSELF:-9 myenigmaself@myenigmaself.gaiden.com
You can create a temporary table in SP1, insert rows into the temp table, execute SP2 and have it process the rows in the temporary table. The scope of a temporary table is not limited to the procedure but rather to the session. Is this what you are seeking?
Example:
Create Procedure spTestReadTempTable
As
Set nocount on
Select * From #tmp
Go
Create Procedure spTestCreateTempTable
As
Set nocount on
Create table #tmp (ID int identity, ColX varchar(6))
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.