sql连着function使用

create  function fun002(@thename varchar(20))
returns int
as
begin
declare @count int
select @count=count(@thename) from cm_ads

return @count-1
end

select dbo.fun002('ads_id')
 select   *,  dbo.fun002('ads_id') from  cm_ads  

 

posted @ 2016-03-15 21:06  纵一苇之所如-  阅读(224)  评论(0编辑  收藏  举报