T-Sql 如何从另一个存储过程中的存储过程返回表 [英] T-Sql How to return a table from a storedproc in another stored proc
本文介绍了T-Sql 如何从另一个存储过程中的存储过程返回表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想做以下事情.基本上有一个存储过程调用另一个返回表的存储过程.这是怎么做的?
I would like to do the following. Basically have a stored procedure call another stored procedure that returns a table. How is this done?
ALTER PROC [GETSomeStuff]
AS
BEGIN
@table = exec CB_GetLedgerView @accountId, @fromDate, @toDate, @pageSize, @pageNumber, @filter, @status, @sortExpression, @sortOrder, @virtualCount OUTPUT
Select * from @table
--Do some other stuff here
END
推荐答案
存储过程的目标必须是临时表或实际表,以便您可以
The target of a stored procedure has to be a temp or actual table so you can
Insert into #table exec CB_GetLedgerView @accountId, @fromDate,
@toDate, @pageSize, @pageNumber,
@filter, @status, @sortExpression,
@sortOrder, @virtualCount OUTPUT
如果存储过程的输出结果集与目标表中的序号位置和行数不匹配,则指定一个列列表.
If the output result set of the stored procedure does not match the ordinal positions and count of the rows in the target table, specify a column list.
这篇关于T-Sql 如何从另一个存储过程中的存储过程返回表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文