CREATE FUNCTION DBO.GET_NUMBER2 ( @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
WHILE CHARINDEX('0',@s,0)=1
BEGIN
SET @S=SUBSTRING(@s,2,LEN(@s))
END
RETURN @S
END
GO