0

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?

1 Answer 1

0

The solution is to encapsulate the conditional operation with parenthesis:

"Preamble
"
+
(@[$Package::myParameter] == ""  ? "" : "Middle Text")
+
"
The End"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.