简体   繁体   中英

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).

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.

I tried many way to achieve this without success:

Attempt 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:

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

Attempt 3:

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

Attempt 4:

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

Attempt 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. 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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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