title: SQL Server- Remove ALL letters in a String
body: <p>If I have a VARCHAR column that has alphanumeric values. How do I remove only the letters and leave all other characters please? This is NOT a duplicate (at least I don't think it is) since I want to leave all special characters and numbers in it's place but remove only alphabets.</p>
  
  <pre><code>    Input       Desired Result
      123         123
      123S        123
      A123,123    123,123
      a123..A123  123..123
  </code></pre>
  
  <p>I have tried using the following but don't get the desired output..</p>
  
  <pre><code>DECLARE @textval NVARCHAR(30)
  SET @textval = 'S123..S123'
  
  SELECT LEFT(SUBSTRING(@textval, PATINDEX('%[0-9.-]%', @textval), 8000),
             PATINDEX('%[^0-9.-]%', SUBSTRING(@textval, PATINDEX('%[0-9.-]%', @textval), 8000) + 'X') -1)
  
  SELECT     STUFF(@textval, 1, PATINDEX('%[0-9]%', @textval)-1, '')
  </code></pre>