我需要改变
ABC2001
ABCD2001
ASDF111111
到
2001
2001
111111
我需要删除SQL Server中的字母字符,不知道吗?
答案 0 :(得分:0)
以下功能需要注意
create function NoLetters(@string2number varchar(200))
returns varchar(200)
as
begin
declare @c int
declare @num varchar(200)
set @num = ''
declare @txtCurrent char(1)
set @c=1
while @c<=len(@string2number)
begin
set @txtCurrent = substring(@string2number,@c,1)
if ascii(@txtCurrent) between 48 and 57
set @num = @num + @txtCurrent
set @c=@c+1
end
return @num
end