create FUNCTION [dbo].[GET_NUMBER](@S VARCHAR(100))
RETURNS VARCHAR(100)
AS
BEGIN
WHILE PATINDEX('%[^0-9]%',@S) > 0
BEGIN
set @s=stuff(@s,patindex('%[^0-9]%',@s),1,'')
END
RETURN @S
END
select [dbo].[GET_NUMBER]('你好111犊子')
2023-12-09 17:48:45
create FUNCTION [dbo].[GET_NUMBER](@S VARCHAR(100))
RETURNS VARCHAR(100)
AS
BEGIN
WHILE PATINDEX('%[^0-9]%',@S) > 0
BEGIN
set @s=stuff(@s,patindex('%[^0-9]%',@s),1,'')
END
RETURN @S
END
select [dbo].[GET_NUMBER]('你好111犊子')