案例条件的 SSIS 派生列未根据需要显示确切结果

SSIS derived column for the case condition doesn't show the exact results as needed

我把这个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")