title: SSIS Derived Column casting numeric(6,0) to ANSI string drops leading digits
body: <p>I have a package that's reading a table from an Oracle data source. The surrogate key for the table (an identity column) was assigned a numeric(6,0) data type by SSIS.</p>
  
  <p>When I take that column into a Derived Column component and cast it as (DT_STR,100,1252) to store in a lookup table downstream, the string column produces incorrect output - but in a very strange way.</p>
  
  <p>Here's some sample output:</p>
  
  <pre>
  ID  ID_AS_STRING
  1   1
  2   2
  3   3
  4   4
  5   5
  6   6
  7   7
  8   8
  9   9
  <b>10   0</b>
  11  11
  12  12
  .
  .
  <b>20   0</b>
  21  21
  22  22
  .
  .
  .
  <b>30   0</b>
  .
  .
  <b>40   0</b>
  </pre>
  
  <p>Basically, it drops the leading digit of the ID if it's divisible by 10 (this goes on into the hundreds and thousands, i.e. 740 becomes 40, 9920 becomes 920.)</p>
  
  <p>Needless to say, this is doubly wrong, since it misses some IDs for the lookup and creates duplicates of others.</p>
  
  <p>If you change the initial column data type to four-bit integer it works fine, so in a way this question is merely academic. But can anyone explain what's going on in SSIS to drop that leading digit of a mod-10 number?</p>