title: How to use substring and PatIndex in SQL Server
body: <p>How to substring data. For example, I have data like this:</p>
  
  <pre><code>+----------------------+
  |John123123412412wqeqw |
  |May1231243334234wawdd |
  |Jo02930124010284jahdj |
  |dy827837127912938hygb |
  +--------------------- +
  </code></pre>
  
  <p>I want the output to be like this:</p>
  
  <pre><code>+----------------------+
  |John                  |
  |May                   |
  |Jo                    |
  |dy                    |
  +--------------------- +
  </code></pre>
  
  <p>As of now I don't understand how to Apply Substring and charindex in my script.</p>
  
  <p>Thanks in advance!</p>