cdun2


Hello,

I have a SQL Task the executes the following statement;

SELECT COUNT(SettleDate) AS CountResult
FROM SettleDateCount

I have the SQL Task Editor configured for a Single Row result set. The Result Name is CountResult, and the variable it populates is RowCountRes. RowCountRes is Int32 with EvaluateAsExpression set to False.

I have a boolean variable called RowCountStatus. It evaluates as the following expression;

@[User::RowCountRes] > 1

From the SQL Task, I have two different constraints, both of which evaluate with an expression. One constraint evaluates this way; @[User::RowCountStatus] = True

The other evaluates this way; @[User::RowCountStatus] = False

The idea is that if the count comes back from the sql statement greater than 1 then execution continues down one path, else it goes down the other path. Currently, the result comes back = 1. I expect that the 'False' path will execute, but the 'True' path executes instead.

What am I doing wrong

Thank you for your help!

cdun2




Re: Problem with Precedence Expression

Jamie Thomson


cdun2 wrote:

Hello,

I have a SQL Task the executes the following statement;

SELECT COUNT(SettleDate) AS CountResult
FROM SettleDateCount

I have the SQL Task Editor configured for a Single Row result set. The Result Name is CountResult, and the variable it populates is RowCountRes. RowCountRes is Int32 with EvaluateAsExpression set to False.

I have a boolean variable called RowCountStatus. It evaluates as the following expression;

@[User::RowCountRes] > 1

From the SQL Task, I have two different constraints, both of which evaluate with an expression. One constraint evaluates this way; @[User::RowCountStatus] = True

The other evaluates this way; @[User::RowCountStatus] = False

The idea is that if the count comes back from the sql statement greater than 1 then execution continues down one path, else it goes down the other path. Currently, the result comes back = 1. I expect that the 'False' path will execute, but the 'True' path executes instead.

What am I doing wrong

Thank you for your help!

cdun2

You should use the watch window to test if the variable truly contains the value that you think it does.

This should help:

Using variables to store expressions

(http://blogs.conchango.com/jamiethomson/archive/2005/12/05/SSIS_3A00_-Using-variables-to-store-expressions.aspx)

-Jamie







Re: Problem with Precedence Expression

cdun2

Thank you!

cdun2






Re: Problem with Precedence Expression

EWisdahl

Don't know for certain, but shouldn't it be @[User::RowCountStatus] == False (NOTE: double equal sign for comparison, single equal for assignment). Seems like it might hit the first test {can rowcountstatus = true, yes} and stops there. I very easily could be wrong though.






Re: Problem with Precedence Expression

cdun2

EWisdahl wrote:
Don't know for certain, but shouldn't it be @[User::RowCountStatus] == False (NOTE: double equal sign for comparison, single equal for assignment).

That was it! Thanks!