数据库创建标量值函数
1 create FUNCTION [dbo].[ispm] (@pmfrist int) 2 RETURNS int 3 AS 4 BEGIN 5 DECLARE @ISvalue int 6 if @pmfrist>0 and @pmfrist<11 7 begin 8 set @ISvalue=1 9 end 10 else 11 begin 12 set @ISvalue=0 13 end 14 RETURN(@ISvalue) 15 END 16 17
1 create FUNCTION [dbo].[ispm] (@pmfrist int) 2 RETURNS int 3 AS 4 BEGIN 5 DECLARE @ISvalue int 6 if @pmfrist>0 and @pmfrist<11 7 begin 8 set @ISvalue=1 9 end 10 else 11 begin 12 set @ISvalue=0 13 end 14 RETURN(@ISvalue) 15 END 16 17