用户自定义函数可以返回表类型,记录T-SQL语法如下:
CREATE FUNCTION <用户自定义函数名称>
(
-- 函数参数
…
)
RETURNS
@<用户自定义返回表名称> TABLE
(
-- 自定义表的列定义
…
)
AS
BEGIN
-- Fill the table variable with the rows for your result set
insert into @<用户自定义返回表名称>
<用于填充用户自定义返回表的查询语句>
RETURN
END
GO
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/81227/viewspace-746870/ ,如需转载,请注明出处,否则将追究法律责任。