Outputting SSIS Expressed Column for Boolean-to-Char CAST

I'm struggling a bit with expressions inside SSIS inferred columns.

My source field is data type BOOLEAN. The target is the SQL CHAR data type.

** Please note that I did not design any of the circuits. If I had my way, the data types would match. Unfortunately, this is not my case!

I found a great example of converting .NET Regular Expression CHAR -to-BOOL. This does the exact opposite of what I am trying to accomplish:

[valToTranslate] == "Y" ? (DT_BOOL)1 : [valToTranslate] == "N" ? (DT_BOOL)0 : NULL(DT_BOOL)

      

I have tried to implement the inverse formula of this expression without success. Here's my failed attempt:

[valToTranslate] == 0 ? (DT_WSTR,1)"N" : [valToTranslate] == 1 ? (DT_WSTR,1)"Y" : "N"(DT_WSTR)

      

I'm not sure if CAST to (DT_WSTR, 1) is even correct for CHAR SQL data type fields? Should I use (DT_STR, 1) instead? Any help is appreciated.

0


a source to share


1 answer


Have you tried just straight

[valToTranslate] ? "Y" : "N"

      



This should do the trick - you may need to drop Y and N into DT_STR if they are supposed to be the default WSTR.

+4


a source







All Articles