没有登录
中国开发网: 论坛: 程序员情感CBD: 贴子 28620
sea026: 别哭了,看看吧
create function fn_LeftASC(@str varchar(4000))
returns int

as
begin
declare @i int,@itmp int,@iReturn int
select @i=1
select @iReturn=0

while @i<=len(@str)
begin
-- select @itmp=convert(int,substring(convert(varbinary,substring(@str ,@i,1)),1,1))
-- if @itmp>127
select @itmp=unicode(substring(@str ,@i,1))
if @itmp>19967 --\u4e00 - 1
begin
select @iReturn=@i-1
break
end

select @i=@i+1
end

return @iReturn

end


--select dbo.fn_LeftASC('PRM065腳釘')

耗费我不短时间,请我客不?

相关信息:


欢迎光临本社区,您还没有登录,不能发贴子。请在 这里登录