sql-serverssisetlexpressionbuilderconditional-split

Why can't I escape double quote characters in SSIS Expression Builder?


I am trying to add a condition to a Conditional Split Transformation in SSIS but the double quote character at the start of a string in the condition is throwing an error.

Here is my condition:

(FirstName != LkUp_FirstName) || ((ISNULL(MiddleName) ? “abc” : MiddleName) != (ISNULL(LkUp_MiddleName) ? “abc” : LkUp_MiddleName)) || (LastName != LkUp_LastName)

Here is the start of the error message I receive when I click OK on the Conditional Split Transformation Editor:

Error at Data Flow Task [Conditional Split [105]]: Attempt to parse the expression "(FirstName != LkUp_FirstName) || ((ISNULL(MiddleName) ? “abc” : MiddleName) != (ISNULL(LkUp_MiddleName) ? “abc” : LkUp_MiddleName)) || (LastName != LkUp_LastName)" failed.  The token " " at line number "1", character number "57" was not recognized. The expression cannot be parsed because it contains invalid elements at the location specified.

I tried to escape the double quotes with a "\" by changing the condition to:

(FirstName != LkUp_FirstName) || ((ISNULL(MiddleName) ? \“abc\” : MiddleName) != (ISNULL(LkUp_MiddleName) ? \“abc\” : LkUp_MiddleName)) || (LastName != LkUp_LastName)

But then I receive the following error:

Error at Data Flow Task [Conditional Split [105]]: Attempt to parse the expression "(FirstName != LkUp_FirstName) || ((ISNULL(MiddleName) ? \“abc\” : MiddleName) != (ISNULL(LkUp_MiddleName) ? \“abc\” : LkUp_MiddleName)) || (LastName != LkUp_LastName)" failed. The token "\" at line number "1", character number "57" was not recognized. The expression cannot be parsed because it contains invalid elements at the location specified.


Solution

  • As Prabhat G has said the “abc” was a copy-paste so I removed the double quote and manually entered it again.

    Lesson learned: it is always better to build your expressions from scratch!