sql 自定义函数

create function dbo.fun(@inputid as varchar(40))
returns int
as
begin
declare @counts int
select @counts=COUNT(*) from Stu_Infor
return @counts
end

declare @input varchar(40)
set @input='2'
select dbo.fun(@input)

自己写个小例子

http://www.cnblogs.com/no7dw/archive/2010/07/08/1773495.html

很详细

 

posted @ 2015-11-09 11:20  monica_guorong  阅读(145)  评论(0编辑  收藏  举报