sqlserver自定义函数

 

 

ALTER function [dbo].[getStaLike](@sex NVARCHAR,@active NVARCHAR,@age decimal,@HEIGHT decimal,@WEIGHT decimal)
returns NVARCHAR(64)
as
begin
return(
select top 1 s.id from standard s where sex=@sex and active= @active order by abs(AGE-@age), abs(HEIGHT-@HEIGHT), abs(WEIGHT-@WEIGHT)
)
end

posted @ 2018-01-23 18:08  baby孔祥超  阅读(133)  评论(0编辑  收藏  举报