内联表值型自定义函数
CREATE FUNCTION dbo.test()
RETURNs TABLE
AS
Return
(
select 0 a,1 b
)
select * from dbotest()
多声明表值型自定义函数
CREATE FUNCTION fun_test
(
-- Add the parameters for the function here
@a numeric(10,2),
@b numeric(10,2)
)
RETURNS
@tab TABLE
(
-- Add the column definitions for the TABLE variable here
aa int,
bb int
)
AS
BEGIN
-- Fill the table variable with the rows for your result set
insert into @tab values(1,2)
RETURN
END
GO
select aa,bb from dbo.test(1.0,2.0)
CREATE FUNCTION dbo.test()
RETURNs TABLE
AS
Return
(
select 0 a,1 b
)
select * from dbotest()
多声明表值型自定义函数
CREATE FUNCTION fun_test
(
-- Add the parameters for the function here
@a numeric(10,2),
@b numeric(10,2)
)
RETURNS
@tab TABLE
(
-- Add the column definitions for the TABLE variable here
aa int,
bb int
)
AS
BEGIN
-- Fill the table variable with the rows for your result set
insert into @tab values(1,2)
RETURN
END
GO
select aa,bb from dbo.test(1.0,2.0)
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10314474/viewspace-756378/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/10314474/viewspace-756378/