title: Using the LEFT Function with the LEN Function
body: <p>I am trying to write a function the will cut off the first 4 chars in a field. For example if the value of the field is <code>ABC_123_EFG</code> it would return <code>123_EFG</code>. I have tried to use a combination of the <a href="http://msdn.microsoft.com/en-us/library/ms177601.aspx" rel="nofollow">LEFT</a> and <a href="http://msdn.microsoft.com/en-us/library/ms190329.aspx" rel="nofollow">LEN</a> functions but haven't had any success.</p>
  
  <p>Here is what I think it should be ...</p>
  
  <pre><code>RIGHT(code, LEN(code) - 4) AS code_concat
  </code></pre>
  
  <p>But it fails with this error</p>
  
  <pre><code>Msg 536, Level 16, State 2, Line 2
  Invalid length parameter passed to the RIGHT function.
  </code></pre>
  
  <p>What am I doing wrong? Is this the best way to accomplish this?</p>