我把这个case的条件表达式作为派生列,结果不符合预期
(DT_STR,255,1252)((Step1_Emc_stg_Heading >= "315" && Step1_Emc_stg_Heading <= "45") ? "Northbound"
: (Step1_Emc_stg_Heading >= "46" && Step1_Emc_stg_Heading <= "135") ? "Eastbound"
: (Step1_Emc_stg_Heading >= "136" && Step1_Emc_stg_Heading <= "225") ? "Southbound"
: (Step1_Emc_stg_Heading >= "226" && Step1_Emc_stg_Heading <= "314") ? "Westbound" : "Nobound")
最佳答案
我认为问题出在第一种情况
Step1_Emc_stg_Heading >= "315" && Step1_Emc_stg_Heading <= "45"
您必须将 45
替换为大于 315
的数字,或者您必须使用逻辑 OR ||
或逻辑 And &&
Step1_Emc_stg_Heading >= "315" || Step1_Emc_stg_Heading <= "45"
更新1
尝试以下表达式(使用数字而不是字符串,并重新排序条件):
(DT_STR,255,1252)((DT_I4)Step1_Emc_stg_Heading <= 45 ? "Northbound"
: (DT_I4)Step1_Emc_stg_Heading <= 135 ? "Eastbound"
: (DT_I4)Step1_Emc_stg_Heading <= 225 ? "Southbound"
: (DT_I4)Step1_Emc_stg_Heading <= 314 ? "Westbound"
: (DT_I4)Step1_Emc_stg_Heading >= 315 ? "Northbound" : "Nobound")
关于sql-server - 案例条件的 SSIS 派生列未根据需要显示确切结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50594855/