With PATINDEX I can find the first occourence of a pattern in a string, say a number - in the string there is several matches to my pattern
My question is how can I find the end position of the first occourence of that pattern in a string?
DECLARE @txt VARCHAR(255)
SET @txt = 'this is a string 30486240 and the string is still going 30485 and this is the end'
PRINT SUBSTRING(@txt,PATINDEX('%[0-9]%',@txt),8)
My problem is, I dont want to put in the 8 in manually, I want to find the length of the first number
Using SQL Server 2012