create function getnum(@code varchar(200))
returns int
as
begin
declare @i int
set @i=0
while charindex('.',@code)>0
begin
set @code=substring(@code,charindex('.',@code)+1,8000)
set @i=@i+1
end
return @i
end语句:
select id,code,dbo.getnum(code) as P_NUM from tablename
returns int
as
begin
declare @i int
set @i=0
while charindex('.',@code)>0
begin
set @code=substring(@code,charindex('.',@code)+1,8000)
set @i=@i+1
end
return @i
end语句:
select id,code,dbo.getnum(code) as P_NUM from tablename
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货