title: SSIS Derived Column Expression for Boolean-to-Char CAST
body: <p>I am having a bit of a struggle with Expressions inside SSIS Derived Columns.</p>
  
  <p>My source field is a BOOLEAN data type. It's destination field is a SQL CHAR datatype. </p>
  
  <p>** Note that I did not design either of the schemas. If I had my way, the data types would match up. Unfortunately, this is not my case!</p>
  
  <p>I found a great example of a .NET Regular Expression converting CHAR-to-BOOL. This does the exact opposite of what I am trying to accomplish:</p>
  
  <pre><code>[valToTranslate] == "Y" ? (DT_BOOL)1 : [valToTranslate] == "N" ? (DT_BOOL)0 : NULL(DT_BOOL)
  </code></pre>
  
  <p>I have tried to implement the reverse formula of this expression with no success. Here is my failing attempt:</p>
  
  <pre><code>[valToTranslate] == 0 ? (DT_WSTR,1)"N" : [valToTranslate] == 1 ? (DT_WSTR,1)"Y" : "N"(DT_WSTR)
  </code></pre>
  
  <p>I am not sure if the CAST to (DT_WSTR,1) is even correct for CHAR SQL datatype fields? Should I be using (DT_STR,1) instead? Any help is greatly appreciated.</p>