Given the following expression,
0 == 0 ? (DT_STR,3,1252)"pre" : (DT_STR,3,1252)"pst"
one would expect that to have a data type of non-unicode string (DT_STR) due to the explicit cast. However, that is not the case, plug that expression into either 2005 or 2008 and it'll set the data type as Unicode string (DT_WSTR). In 2005, you still had the option of "fixing" data types but that feature has been removed in 2008. See attached screen shots.
The solution with much thanks to @VidasM is to cast the results of the ternary operator to string. I had tried that but operator precedence threw me off.
(DT_STR,3,1252)(0 == 0 ? "pre" : "pst"))
No comments:
Post a Comment