这个 SSIS 派生表达式出了什么问题
What is going wrong with this SSIS derived Expression
((DT_STR,20,1252)OccuranceRegion == "US" && ((DT_STR,20,1252)LegalEntity == "AECB" || (DT_STR,20,1252)LegalEntity == "FSB" || (DT_STR,20,1252)LegalEntity == "Both"))
? DATEADD("day",30,CapCreationDt) : (ISNULL(MaxofRevSCIAndSCI) ? (DT_DATE)"1900-01-01" : MaxofRevSCIAndSCI)
每当我把条件设为
OccuranceRegion == "US" AND
LegalEntity is null
结果为NULL,我也检查了MaxofRevSCIAndSCI的值,它不为空。为什么,它不会进入其他部分?
任何 NULL 函数(特殊的 "NULL-killing" 函数 ISNULL 等除外)的计算结果为 NULL。您只将 LegalEntity 与字符串常量进行比较。如果 LegalEntity 为 NULL,这些表达式将计算为 NULL。您需要用其他内容替换 LegalEntity 中的 NULL 值。可能是上游的派生列
ISNULL(LegalEntity) ? "##NULL#' : LegalEntity
比在表达式本身中执行此操作更容易(因为 SSIS 表达式很难调试)。
((DT_STR,20,1252)OccuranceRegion == "US" && ((DT_STR,20,1252)LegalEntity == "AECB" || (DT_STR,20,1252)LegalEntity == "FSB" || (DT_STR,20,1252)LegalEntity == "Both"))
? DATEADD("day",30,CapCreationDt) : (ISNULL(MaxofRevSCIAndSCI) ? (DT_DATE)"1900-01-01" : MaxofRevSCIAndSCI)
每当我把条件设为
OccuranceRegion == "US" AND
LegalEntity is null
结果为NULL,我也检查了MaxofRevSCIAndSCI的值,它不为空。为什么,它不会进入其他部分?
任何 NULL 函数(特殊的 "NULL-killing" 函数 ISNULL 等除外)的计算结果为 NULL。您只将 LegalEntity 与字符串常量进行比较。如果 LegalEntity 为 NULL,这些表达式将计算为 NULL。您需要用其他内容替换 LegalEntity 中的 NULL 值。可能是上游的派生列
ISNULL(LegalEntity) ? "##NULL#' : LegalEntity
比在表达式本身中执行此操作更容易(因为 SSIS 表达式很难调试)。