Monday 24 October 2016

SSIS Error "DT_GUID" cannot be used with binary operator "!=" while doing incremental load.

Issue:

While doing incremental load in SSIS we have a condition to chehck whether source and target column values are same or not

So in Conditional Split transformation we did a comparison like
[Source_colum != Target_Column]

But when we used a column with data type uniqueidentifier we encountered an issue as shown below.


Cause: 

The column that we used for comparison have data type DT_GUID and that cannot be used for binary operation.

Solution:

Cast the datatype to character and we can use that for comparison.

SSIS format for casting to string  (DT_STR,50,1252)[Colum_Name]

(DT_STR,30,1252) casts 30 bytes, or 30 single characters, to the DT_STR data type using the 1252 code page.


So code used for comparison (DT_STR,30,1252)Source_column != (DT_STR,30,1252)Target_column