可存储过程返回表 [英] can stored procedure return table

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

问题描述

尊敬的先生

可以存储过程返回表

请使用示例

Dear sir

Can store procedure return table

please explain with example

推荐答案

你好


看看这个


http://stackoverflow.com/questions/1443663/how-to- return-temporary-table-from-stored-procedure [ ^ ]

http://odetocode.com/articles/365.aspx [
Hello


Check this out


http://stackoverflow.com/questions/1443663/how-to-return-temporary-table-from-stored-procedure[^]

http://odetocode.com/articles/365.aspx[^]


没有SP不能返回表.

返回"和结果集"不同,无论从SP内部的选择查询返回的值是什么,都不是返回值.

SP只能有一个值作为返回类型,不能是表.

但是UDF可以返回已定义/未定义的表.

这就是为什么我们不能在我们的select语句中使用SP,但是可以在其中使用函数(UDF)的原因.
在给定的链接上阅读更多详细信息.

http://geekswithblogs.net/NewThingsILearned/archive/2008/09/17/get-return-value-from-stored-procedure.aspx [
No SPs can not return table.

to ''Return'' is different and ''Result Set'' is different, whatever the values are returned from a select query inside the SP is not return value.

SP can have only one value as return type, it can not be table.

but UDF''s can return defined/undefined tables.

thats why we can not use SP inside our select statement but we can use functions (UDFs) in it.

read more details at the given link.

http://geekswithblogs.net/NewThingsILearned/archive/2008/09/17/get-return-value-from-stored-procedure.aspx[^]


是的,可以.

一个简单的例子是:

yes, it can.

simple example is:

CREATE PROCEDURE Test_Proc
AS
BEGIN
 SELECT column_1, column_2 From table_name
END
GO



上面的SP将从table_name返回数据

还请查看以下有关存储过程返回的数据的文章:

http://www.sqlteam.com/article/stored-procedures-returning-data [ ^ ]



Above SP will return data from table_name

also check the following article on data returned by Stored procedure:

http://www.sqlteam.com/article/stored-procedures-returning-data[^]


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

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