Link to home
Start Free TrialLog in
Avatar of parpaa
parpaa

asked on

Error in conversion of ssis task flow

Hello experts

I am trying to execute a sql statement and taking it into a variable 'count', the count value could be any integer, now if i assigned 'string' as its data type, if i change it to int32, it fails. now following that i have 2 exec sql tasks.

From the result set above, if my count is 0, then i should update a table as failure, if not success.

Now the error i am getting is
"The data types "DT_WSTR" and "DT_I4" are incompatible for binary operator ">". The operand types could not be implicitly cast into compatible types for the operation. To perform this operation, one or both operands need to be explicitly cast with a cast operator", i tried to google it, but couldn't solve the problem.

Thanks
Avatar of Brendt Hess
Brendt Hess
Flag of United States of America image

The problem is in the basic logic of comparing a string to a number.  Is the number 144 (not the string '144', but the numeric value) greater than or less than 'Cat'?  It's undefined, so you must explicitly cast one of the values (probably the wstr value) to a compatible type for the comparison.
Avatar of parpaa
parpaa

ASKER

ok yes i agree with that, but i dont know why for some reason if i only mention string as the data type it suceeds. here is my variable @count, now my current expression comparison is @count < 1  and @count >0, what would be the syntax to include the cast for one of them?
ASKER CERTIFIED SOLUTION
Avatar of Brendt Hess
Brendt Hess
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of parpaa

ASKER

i got it..

>>but why a count between 0 and 1?  Just a poor example?
 my count result would be any integer starting 0.f


thanks.