title: T-SQL Find length of word within a string
body: <p>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</p>
  
  <p>My question is how can I find the end position of the first occourence of that pattern in a string?</p>
  
  <pre><code>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)
  </code></pre>
  
  <p>My problem is, I dont want to put in the 8 in manually, I want to find the length of the first number</p>
  
  <p>Using SQL Server 2012</p>