title: How to trim everything after certain character in sql
body: <p>I am trying to format the email address in my table by removing everything starting the @.  Also I would like to replace the underscore with blank space. </p>
  
  <p>For example:
  <code>FirstName_LastName@gmail.com</code></p>
  
  <p>I would like the above email to be changed like this:
  <code>FirstName LastName</code></p>
  
  <p>Here is my code but this trims everything after the @ and that is what i want. But how can i replace the underscore with blank.  I want all in one statement using the update function.  How can I do that?</p>
  
  <pre><code>SELECT 
       left (Email, CHARINDEX('@',Email)-1)
    FROM [Dashboard]
  </code></pre>
  
  <p>Thanks for the help</p>