一个简单的SQL函数
为什么下面的函数总提示:
在关键字 'asc' 附近有语法错误。
请问在SQL里asc函数可以用哪个函数代替?或有没有更多的函数推荐,谢谢大家
create function [TeststrLength] (@str varchar(3000))
returns int
as
begin
declare @l int
declare @t int
declare @c bigint
declare @i int
Set @l=len(@str)
Set @t=@l
Set @i=1
while(@i<=@l)
Begin
@c=asc(mid(@str,@i,1)) --就是这地方
If(c<0)@c=@c+65536
If(@c>255)@t=@t+1
@i=@i+1
end
@strLength=t\2
End