sql存储过程可以返回多个表. [英] can a sql store procedure return more than one table.

查看:165
本文介绍了sql存储过程可以返回多个表.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



sql存储过程可以返回多个表吗?

怎么样?



谢谢

Hi,

can a sql store procedure return more than one table .

how?



Thanks

推荐答案

是的,它可以

yes, it can

create procedure sp_return2tables
As
Select * from table1
Select * from table2
GO



它将做到,您可以在前端从数据集1和数据集2中获取值.
我希望这能解决您的要求.

Anurag



It will do, on the front-end you can fetch the values from dataset1 and dataset2.
I hope this will solve your requirement.

Anurag


是的.
CREATE PROCEDURE spSomeStoredProcedure AS 
BEGIN

Select * from table1

Select * from table2

Select * from table3

END
GO 



并检查一下.

http://shan-tech.blogspot.com/2005/08/sql-server-stored-procedures-returning.html [ ^ ]



and check this also.

http://shan-tech.blogspot.com/2005/08/sql-server-stored-procedures-returning.html[^]


是的,上面的答案是正确的...但是从技术上讲,它们不返回表. ...作为输出.....因为它们没有返回类型作为Table .....但它们处理查询并将表作为输出....如果需要捕获....您使用ADO .NET并通过它们给定的代码检索由它处理的所有表......
yes the above ans are correct ... but technically speaking they don''t return the tables ..... as an output ..... since because they don''t have there return type as a Table ..... but they process the query and give the table as an output .... which if you want to capture .... you an use the ADO .NET and retrieve all the tables processed by it by the code that they have given ......


这篇关于sql存储过程可以返回多个表.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆