简体   繁体   English

如何比较SSIS条件拆分中的两个GUID?

[英]How to compare two GUIDs in SSIS Conditional Split?

I have seen this question and I tried what it suggested, but without any success (see Attempt 1 below). 我已经看到了这个问题,我尝试了它的建议,但没有任何成功(参见下面的尝试1)。

I have tried the below conditions in my Conditional Split without success. 我在条件分割中尝试了以下条件但没有成功。 I have checked that records exist prior to the conditional split that fit the criteria so I should be getting data from the conditional split, but I am not getting any data. 我已经检查了符合条件的条件拆分之前存在的记录,所以我应该从条件拆分中获取数据,但是我没有得到任何数据。 I also verified that the other two conditions are working correctly independently of the GUID comparison. 我还验证了其他两个条件是否正常工作,与GUID比较无关。

I tried many way to achieve this without success: 我尝试了很多方法来实现这一目标但没有成功

Attempt 1: 尝试1:

CompanyGUIDString = (DT_WSTR,50)CompanyID  // In Derived Column

// Conditional Split Condition
ISNULL(AssociationID) ==  FALSE  && ccseq_associationtype == 2 && CompanyGUIDString == "7C46BB0B-AEF3-E611-80E0-005056B33317" 

Attempt 2: 尝试2:

ISNULL(AssociationID) ==  FALSE  && ccseq_associationtype == 2 && CompanyID == "7C46BB0B-AEF3-E611-80E0-005056B33317" 

Attempt 3: 尝试3:

ISNULL(AssociationID) ==  FALSE  && ccseq_associationtype == 2 && (DT_WSTR, 50) CompanyID == (DT_WSTR,50) "7C46BB0B-AEF3-E611-80E0-005056B33317" 

Attempt 4: 尝试4:

ISNULL(AssociationID) ==  FALSE  && ccseq_associationtype == 2 && (DT_STR, 50, 1252) CompanyID == (DT_STR, 50, 1252) "7C46BB0B-AEF3-E611-80E0-005056B33317"

Attempt 5: 尝试5:

ISNULL(AssociationID) ==  FALSE  && ccseq_associationtype == 2 && (DT_GUID) CompanyID == (DT_GUID) "7C46BB0B-AEF3-E611-80E0-005056B33317"  

I discovered the answer. 我发现了答案。 When you convert a GUID to a String, the cast adds "{}" to the GUID. 将GUID转换为String时,强制转换将“{}”添加到GUID。 The code below will work correctly. 以下代码将正常工作。

(ISNULL(AssociationID) ==  FALSE ) && (ccseq_associationtype == 2) && (UPPER((DT_WSTR,50)CompanyID) == UPPER((DT_WSTR,50)"{7C46BB0B-AEF3-E611-80E0-005056B33317}"))

Your expression looks fine, but note thay SSIS expressions are case sensitive, Just add parenthesis and use UPPER() function 你的表达式看起来很好,但请注意SSIS表达式区分大小写,只需添加括号并使用UPPER()函数

(ISNULL(AssociationID) ==  FALSE)  &&
([ccseq_associationtype] == 2) && 
(UPPER((DT_WSTR, 50)[CompanyGUIDString]) == UPPER("7C46BB0B-AEF3-E611-80E0-005056B33317"))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM