Code


    WHILE PATINDEX('%[^a-z]%',@S)>0
          
BEGIN
                
set @s=stuff(@s,patindex('%[^a-z]%',@s),1,'')
          
END
    
RETURN @S
END
GO
--测试
select  dbo.F_Get_STR('测试ABC123ABC')


GO

/*
     create 2008-11-26
    功能:获取字符串中的字母
 
*/
create function dbo.F_Get_Number (@S varchar(100))
returns int
AS
begin
    
while PATINDEX('%[^0-9]%',@S)>0
          
begin
                
set @s=stuff(@s,patindex('%[^0-9]%',@s),1,'')
          
end
    
return cast(@S as int)
end
--测试
--
-select  dbo.F_Get_Number('测试AB3C123AB5C')

GO

相关文章:

  • 2022-01-19
  • 2022-01-19
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2022-12-23
猜你喜欢
  • 2022-03-03
  • 2021-08-11
  • 2022-01-03
  • 2022-01-11
  • 2021-12-05
  • 2021-08-02
  • 2022-02-28
相关资源
相似解决方案