CREATE FUNCTION [dbo].[fn_GetIntFromText] (@name VARCHAR(max))
RETURNS NVARCHAR(max)
AS
BEGIN
DECLARE @str VARCHAR(MAx)
SET @str
= @name
WHILE PATINDEX('%[^0-9]%', @str) > 0
SET @str = REPLACE(@str, SUBSTRING(@str, PATINDEX('%[^0-9]%', @str), 1), '')
RETURN replace(@str, '-', '')
END
Very nice article
ReplyDeleteThanks