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