sqlsql-serverssisetlconditional-split

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"  

Solution

  • 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}"))