create function fun_A() #标题函数、create function fun_name() returns output_type as begin return value end;
returns int
as
begin
return 1;
end
go
create function fun_B() #多语句用户定义函数、create function fun_name() returns @value table(colum_list) as begin return ; end
returns @tb table(ID int ,Name nvarchar(8))
as
begin
insert into @tb(ID,Name) values(1,‘111‘),(2,‘222‘);
return;
end
go
create function fun_C() #内联用户定义函数、create function fun_name() returns table as return select......;
returns table
as
return select 1 as A,2 as B,3 as C;
go
时间: 2024-11-11 02:07:42