我需要改变
ABC2001
ABCD2001
ASDF111111
到
2001
2001
111111
我需要删除 SQL Server 中的字母字符,知道吗?
下面的功能会照顾
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