title: How to return first few characters in a string by trimming last 8? (SQL Server 2008)
body: <p>I have a bunch of strings like this:</p>
  
  <pre><code> 'ABCD99991000'
   'XYZ79991000'
   'E2493991039'
  </code></pre>
  
  <p>What I really care about is everything before the last 8 characters.  The problem is that the characters I care about at the start of the string are of variable length.  In the above examples, what I'd want to return is:</p>
  
  <pre><code> 'ABCD'
   'XYZ'
   'E24'
  </code></pre>
  
  <p>The RIGHT() function would be perfect if I could get it to return everything BEFORE the results.  For example, RIGHT(E2499991039,8) returns the numbers I don't want!  How can I return the variable length strength before the last 8 characters in my query?</p>
  
  <p>SQL Server 2008</p>