日期:2014-05-17 浏览次数:20788 次
create function F_getasc(@str varchar(max)) returns @tb table(A int) as begin declare @asc int=0 while LEN(@str)>0 begin set @asc=@asc+ascii(LEFT(@str,1)) set @str=SUBSTRING(@str,2,LEN(@str)) end insert into @tb values(@asc) return end --测试 select * from f_getasc('abc')