title: Getting only numbers after and before alphabets
body: <p>I have few telephone number like this:</p>
  
  <pre><code>            Tele
              -----
              251510X25    
              364680X5 
              12345,X34
              12345X
              x57823889
              1234567X12/7
              1234567X,12/7
  </code></pre>
  
  <p>I want rto get the telephone  having numeric before and after X only
  My output should be:</p>
  
  <pre><code>            Tele
              -----
              251510X25    
              364680X5 
              1234567X12/7
  </code></pre>
  
  <p>I have written a query like this:</p>
  
  <pre><code>            SELECT ID,TELP,
                   CASE 
                       WHEN PATINDEX('%[0-9]%', TELP) &gt;0  THEN 
                           RTRIM(LEFT(TELP, PATINDEX('%[0-9]%', TELP)-1)) 
                       ELSE TELP 
                   END as TELP1
               FROM [teble1] where len(TELP) &lt;=10 and PATINDEX('%[0-9]%', TELP) &gt;0 
               and (TELP like '%x%' or TELP like '%/%')
  </code></pre>
  
  <p>I 'm unable to get the desired output. I have around 100k records like this.</p>