title: Re Invalid length parameter passed to the RIGHT function
body: <p>I am stuck with this error and unable to progress.</p>
  
  <p>Any idea on this error?</p>
  
  <pre><code>CASE WHEN mm.[Moodle Courses Category] + '_' +ISNULL(RIGHT(ttg.TTGP_Group_Code, LEN(ttg.TTGP_Group_Code)-11),'V1') like '%/%' THEN
          mm.[Moodle Courses Category] + '_' +ISNULL(RIGHT(ttg.TTGP_Group_Code, LEN(ttg.TTGP_Group_Code)-11),'V1')
        ELSE
          mm.[Moodle Courses Category] + '_' +ISNULL(RIGHT(ttg.TTGP_Group_Code, LEN(ttg.TTGP_Group_Code)-11),'V1') END AS GROUP_ID
  </code></pre>
  
  <p>Error: Msg 536, Level 16, State 2, Line 1
  Invalid length parameter passed to the RIGHT function.</p>