您的位置:首页 > 博客中心 > 数据库 >

SQL_创建函数

时间:2022-03-14 00:36

--函数声明
create function myAdd(@a int, @b int)
returns int
as 
begin
declare @c int
set @c = @a + @b
return @c
end 

--函数调用
declare @a1 int
declare @b1 int 
declare @c1 int 

set @a1 = 1 
set @b1 = 100
set @c1=dbo.myAdd(@a1,@b1)
print cast(@c1 as nvarchar(10))

 

热门排行

今日推荐

热门手游