Consider the following simple expression in SQL Server SSIS, where a variable is built with the following expression containing a conditional operator:
"Preamble
"
+
@[$Package::myParameter] == "" ? "" : "Middle Text"
+
"
The End"
The logic is simple. If myParameter has a value, the "Middle Text" bit will be shown. If there is no value, then it will show nothing. While the conditional seems to work fine, I noticed that any text/expression I have prior to the operator is simply ignored. In this case, the "Preamble" text is never shown regardless if the boolean check gets to TRUE or FALSE.
Any ideas?
Best Answer
The solution is to encapsulate the conditional operation with parenthesis: