SQL SERVER 提取字符串中数字
CREATE FUNCTION [dbo].[GET_NUMBER] (@S VARCHAR(100))
RETURNS VARCHAR(100)
AS
BEGIN
WHILE PATINDEX('%[^0-9\\.\\^0-9]%', @S) > 0
BEGIN
SET @S = STUFF(@S, PATINDEX('%[^0-9\\.\\^0-9]%', @S), 1, '');
END;
RETURN @S;
END
PATINDEX用法详细推荐