title: cast and substring
body: <p>I'm having a little bit of trouble trimming my join keys for an SSIS transformation.</p>
  
  <pre><code>SELECT year_time, substring(rtrim(cast(region_code+county_code+district_code as varchar(100)), 5,4)as DR, rtrim(ltrim(T1.district_name)) as 'DNR', SUM(CAST(K12 AS INT)) AS 'TR'   
  FROM Database_Table
  GROUP BY year_time, region_code+county_code+district_code, district_name
  order by year_time, district_code_raw, district_name_raw
  </code></pre>
  
  <p>I'm getting an error that my rtrim function requires 1 argument.  I believe the error is on the concatenation.  </p>