Building Dynamic Queries in the Expression Builder – The data types "DT_WSTR" and "DT_I4" are incompatible for binary operator "+".

  • 9 April 2024
  • 0 replies
  • 16 views

Userlevel 2
Badge

The issue arises when trying to Evaluate an expression that contains a normal SQL Query and attempting to use a UserDefined Variable in the Expressions that have a data type other than WSTR (string). The error tells us that it cannot concatenate the two expressions together due to the mismatch in data types.  

 

 

To overcome this, you will need to cast the said datatype into a string for the expressions to be evaluated correctly. You can do so by changing the query and putting (DT_WSTR,50)  before the variable: @[User::Variable1] 

 

 

Another way is to change the way this variable is evaluated. In Variable Properties, change EvaluateAsExpression to True and then below it you can control how this expression will be evaluated - (DT_WSTR,50) @[User::Variable1]This workaround works for any data types other than string. 

 

 


This topic has been closed for comments