title: SSIS Derived Column System Variable Length with expression
body: <p>I have a source column, KEY2 that I need to perform some string manipulation on within the Derived Column transformation within SSIS. It's configured as the following</p>
  
  <pre><code>KEY2        
  Replace 'KEY2'  
  
  (FINDSTRING(KEY,",",1) - 2) &gt; 0 ? 
    SUBSTRING(KEY,FINDSTRING(KEY,",",1) + 2,LEN(KEY) - FINDSTRING(KEY,",",1) - 1) : ""
  
  string [DT_STR]     
  1                       
  1252  (ANSI - Latin I)
  </code></pre>
  
  <p>The length is 1.  I need to change it to 100.  I have tried this:</p>
  
  <pre><code>(DT_STR,100)(FINDSTRING(KEY,",",1) - 2) &gt; 0 ?
  </code></pre>
  
  <p>SUBSTRING(KEY,FINDSTRING(KEY,",",1) + 2,LEN(KEY) - FINDSTRING(KEY,",",1) - 1) : ""</p>
  
  <p>However, I am prompted with a parse error.  What is the problem?</p>
  
  <p><strong>Update</strong></p>
  
  <p>I have followed markTheLiars' answer.  The expression now looks like this:</p>
  
  <pre><code>KEY2        Replace 'KEY2'      (DT_STR,100,1252)((FINDSTRING(KEY,",",1) - 2) &gt; 0 ? 
  SUBSTRING(KEY,FINDSTRING(KEY,",",1) + 2,LEN(KEY) - FINDSTRING(KEY,",",1) - 1) : "")     string [DT_STR]     1                       1252  (ANSI - Latin I)
  </code></pre>
  
  <p>The expression compiles and runs, however I am prompted with the same error as the length does not change even though there is a cast.</p>