sql-serverssisetlconditional-split

SSIS Conditional Split Error - The data type DT_BYTES cannot be used with binary operator "=="


While configuring a conditional split component with the following expression:

[VersionStamp_Source] == (DT_I8)[VersionStamp_Destination]

I am getting the following error:

The data type DT_BYTES cannot be used with binary operator "==".

Screenshot:

enter image description here


Solution

  • As shown in the error message, one of the columns used in the conditional split expression has a data type of DT_BYTES which cannot be compared using binary operators.

    You need to cast this column to another data type. As mentioned in the official documentation, DT_BYTES can be converted to DT_I8 or to a string data type.

    enter image description here

    As @billinkc mentioned in the comments, casting DT_BYTES to a string data type is more preferable since some values cannot be converted to an 8-byte integer.

    To solve your problem, try using the following expression:

        (DT_WSTR,255)[VersionStamp_Source] == (DT_WSTR,255)[VersionStamp_Destination]
    

    Also, make sure to use an accurate length for the string casting operator. You can increase the string length to 4000