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)
是否可以将对exec sp_executesql的调用结果存储在'table parameter'中。参数值用于另一个SQL存储过程(SQL 2000/2005)
2 个解决方案
#1
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 ...
您可以做的最好是将值插入临时表(使用INSERT EXEC模式),然后在链中的第二个过程中使用该临时表...
#2
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
如果您想将某些进程的结果存储在表变量中,我建议将其设置为表值函数而不是sproc。这样,您就可以在您正在进行的任何其他处理中使用第一个函数的最终结果
Select * from MyTableValueFunction()
#1
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 ...
您可以做的最好是将值插入临时表(使用INSERT EXEC模式),然后在链中的第二个过程中使用该临时表...
#2
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
如果您想将某些进程的结果存储在表变量中,我建议将其设置为表值函数而不是sproc。这样,您就可以在您正在进行的任何其他处理中使用第一个函数的最终结果
Select * from MyTableValueFunction()