CREATE function func(@id int)
returns varchar(8000)
as
begin
 return(.....)
end
 
 应用如下:
 
select func(id) as yy from .....