作者:琉璃梦0_471 | 来源:互联网 | 2023-01-04 08:25
IamhavingabitofastrugglewithExpressionsinsideSSISDerivedColumns.我在SSISDerivedColumns
I am having a bit of a struggle with Expressions inside SSIS Derived Columns.
我在SSIS Derived Columns中与Expressions进行了一些斗争。
My source field is a BOOLEAN data type. It's destination field is a SQL CHAR datatype.
我的源字段是BOOLEAN数据类型。它的目标字段是SQL CHAR数据类型。
** 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!
**请注意,我没有设计任何一个模式。如果我按照自己的方式,数据类型将匹配。不幸的是,这不是我的情况!
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:
我发现了一个很好的.NET正则表达式转换CHAR-to-BOOL的例子。这与我想要实现的完全相反:
[valToTranslate] == "Y" ? (DT_BOOL)1 : [valToTranslate] == "N" ? (DT_BOOL)0 : NULL(DT_BOOL)
I have tried to implement the reverse formula of this expression with no success. Here is my failing attempt:
我试图实现这个表达式的反向公式但没有成功。这是我失败的尝试:
[valToTranslate] == 0 ? (DT_WSTR,1)"N" : [valToTranslate] == 1 ? (DT_WSTR,1)"Y" : "N"(DT_WSTR)
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.
我不确定CAST到(DT_WSTR,1)对于CHAR SQL数据类型字段是否正确?我应该使用(DT_STR,1)吗?任何帮助是极大的赞赏。
1 个解决方案