Create function AvgResult(@scode varchar(10)) Returns real As Begin Declare @avg real set @avg='1.2'; Return @avg End
调用方法:
select dbo.AvgResult('s0002') as result