SSIS运行时的变量表达评估异常行为

时间:2018-11-03 13:30:13

标签: sql-server ssis etl

在SSIS中,我有一个名为“ Contract”的变量,其表达式如下所示:

"SELECT C.CONTRACTNUM AS BL_CONTRACTNUM,  C.EXTREFERENCE AS BL_EXTREFERENCE,  C.REVISIONNUM AS BL_REVISIONNUM,  A.BL_SERIALNUM,  A.BL_DESCRIPTION,  A.BL_COMPANY,  A.BL_PARTNUM,  CASE WHEN  A.BL_WARRANTYSTARTDATE < TO_DATE('01-01-1753','DD-MM-YYYY') THEN NULL ELSE to_char( A.BL_WARRANTYSTARTDATE, 'YYYY-MM-DD HH24:MI:SS') END AS BL_WARRANTYSTARTDATE,  CASE WHEN  A.BL_WARRANTYENDDATE < TO_DATE('01-01-1753','DD-MM-YYYY') THEN NULL ELSE to_char( A.BL_WARRANTYENDDATE, 'YYYY-MM-DD HH24:MI:SS') END AS BL_WARRANTYENDDATE,  C.CUSTOMER BL_CUSTOMER,  A.BL_CONTRACTLINENUM,  A.BL_COVERAGE,  CASE WHEN  A.BL_ENDOFMAINTDATE < TO_DATE('01-01-1753','DD-MM-YYYY') THEN NULL ELSE to_char( A.BL_ENDOFMAINTDATE, 'YYYY-MM-DD HH24:MI:SS') END AS BL_ENDOFMAINTDATE,  CASE WHEN  A.BL_ENDOFSALESDATE < TO_DATE('01-01-1753','DD-MM-YYYY') THEN NULL ELSE to_char( A.BL_ENDOFSALESDATE, 'YYYY-MM-DD HH24:MI:SS') END AS BL_ENDOFSALESDATE,  CASE WHEN  A.BL_ENDOFSUPPORTDATE < TO_DATE('01-01-1753','DD-MM-YYYY') THEN NULL ELSE to_char(A.BL_ENDOFSUPPORTDATE, 'YYYY-MM-DD HH24:MI:SS') END AS BL_ENDOFSUPPORTDATE,  A.BL_CINUM,  NULL as CIDESCRIPTION,  C.STATUS,  A.BL_ISLIGHTCI,  A.BL_LOCATION,  CASE WHEN  A.BL_CREATEDDATE < TO_DATE('01-01-1753','DD-MM-YYYY') THEN NULL ELSE to_char( A.BL_CREATEDDATE, 'YYYY-MM-DD HH24:MI:SS') END AS BL_CREATEDDATE,  CASE WHEN  A.BL_CHANGEDATE < TO_DATE('01-01-1753','DD-MM-YYYY') THEN NULL ELSE to_char( A.BL_CHANGEDATE, 'YYYY-MM-DD HH24:MI:SS') END AS BL_CHANGEDATE,  A.BL_CHANGEBY,  CASE WHEN  A.BL_LOCATIONCHANGEDATE < TO_DATE('01-01-1753','DD-MM-YYYY') THEN NULL ELSE to_char( A.BL_LOCATIONCHANGEDATE, 'YYYY-MM-DD HH24:MI:SS') END AS BL_LOCATIONCHANGEDATEFROM MAXIMOMIS.BL_MSINV_CONTRACT CLEFT JOIN MAXIMOMIS.BL_MSINV_ALL_EQUIP A on C.CONTRACTNUM = A.BL_CONTRACTNUM AND C.REVISIONNUM = A.BL_REVISIONNUMLEFT JOIN MAXIMOMIS.BL_MSINV_MAXIMOCI CI ON CI.CINUM = a.BL_CINUM AND CI.SERIALNUMBER = a.BL_SERIALNUMWHERE C.EXTREFERENCE is not nullAND c.REVISIONNUM is not nullAND c.STATUS = 'APPR' " + (@[User::varLoadType] == "Daily" ?  "AND (C.MODIFIEDDATE > (sysdate - " + @[User::varDays]  + "))"  : "")

当我评估此表达式时,我得到以下内容

SELECT C.CONTRACTNUM AS BL_CONTRACTNUM,C.EXTREFERENCE AS BL_EXTREFERENCE,C.REVISIONNUM AS BL_REVISIONNUM,A.BL_SERIALNUM,A.BL_DESCRIPTION,A.BL_COMPANY,A.BL_PARTNUM,CASE WHEN  A.BL_WARRANTYSTARTDATE < TO_DATE('01-01-1753','DD-MM-YYYY') THEN NULL ELSE to_char( A.BL_WARRANTYSTARTDATE, 'YYYY-MM-DD HH24:MI:SS') END AS BL_WARRANTYSTARTDATE, CASE WHEN  A.BL_WARRANTYENDDATE < TO_DATE('01-01-1753','DD-MM-YYYY') THEN NULL ELSE to_char( A.BL_WARRANTYENDDATE, 'YYYY-MM-DD HH24:MI:SS') END AS BL_WARRANTYENDDATE,C.CUSTOMER BL_CUSTOMER,A.BL_CONTRACTLINENUM, A.BL_COVERAGE,CASE WHEN  A.BL_ENDOFMAINTDATE < TO_DATE('01-01-1753','DD-MM-YYYY') THEN NULL ELSE to_char( A.BL_ENDOFMAINTDATE, 'YYYY-MM-DD HH24:MI:SS') END AS BL_ENDOFMAINTDATE,CASE WHEN  A.BL_ENDOFSALESDATE < TO_DATE('01-01-1753','DD-MM-YYYY') THEN NULL ELSE to_char( A.BL_ENDOFSALESDATE, 'YYYY-MM-DD HH24:MI:SS') END AS BL_ENDOFSALESDATE,CASE WHEN  A.BL_ENDOFSUPPORTDATE < TO_DATE('01-01-1753','DD-MM-YYYY') THEN NULL ELSE to_char(A.BL_ENDOFSUPPORTDATE, 'YYYY-MM-DD HH24:MI:SS') END AS BL_ENDOFSUPPORTDATE,A.BL_CINUM,NULL as CIDESCRIPTION,C.STATUS,A.BL_ISLIGHTCI, A.BL_LOCATION,CASE WHEN  A.BL_CREATEDDATE < TO_DATE('01-01-1753','DD-MM-YYYY') THEN NULL ELSE to_char( A.BL_CREATEDDATE, 'YYYY-MM-DD HH24:MI:SS') END AS BL_CREATEDDATE,CASE WHEN  A.BL_CHANGEDATE < TO_DATE('01-01-1753','DD-MM-YYYY') THEN NULL ELSE to_char( A.BL_CHANGEDATE, 'YYYY-MM-DD HH24:MI:SS') END AS BL_CHANGEDATE,A.BL_CHANGEBY,CASE WHEN  A.BL_LOCATIONCHANGEDATE < TO_DATE('01-01-1753','DD-MM-YYYY') THEN NULL ELSE to_char( A.BL_LOCATIONCHANGEDATE, 'YYYY-MM-DD HH24:MI:SS') END AS BL_LOCATIONCHANGEDATEFROM MAXIMOMIS.BL_MSINV_CONTRACT CLEFT JOIN MAXIMOMIS.BL_MSINV_ALL_EQUIP A on C.CONTRACTNUM = A.BL_CONTRACTNUM AND C.REVISIONNUM = A.BL_REVISIONNUM LEFT JOIN MAXIMOMIS.BL_MSINV_MAXIMOCI CI ON CI.CINUM = a.BL_CINUM AND CI.SERIALNUMBER = a.BL_SERIALNUM WHERE C.EXTREFERENCE is not null AND c.REVISIONNUM is not null AND c.STATUS = 'APPR' AND (C.MODIFIEDDATE > (sysdate - 7))

当我在Oracle sql / developer工具中运行以上查询时。我有18行。

但是,在运行时在执行sql任务中使用变量“合同”时,它将产生3775行。我已经设置了断点,并确保查询的值等于(在调试期间在监视窗口中)与上面相同的值。

因此,我对为什么在运行时不产生18行而不产生3775行感到困惑吗?

更令人困惑的是,除了select和join不同而且它们都能正常工作外,我还有其他表达式具有完全相似的表达式。

我什至检查了dtsx软件包<DtsVariable>的xml代码是否正确显示。我不确定我在这里缺少什么,有人可以指出是否有问题吗?

0 个答案:

没有答案