Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SSIS and Import/Export (2008)
 Derived Column Expression Help

Author  Topic 

masterdineen
Aged Yak Warrior

550 Posts

Posted - 2011-01-17 : 09:33:04
I have a column with the following expression

(ISNULL(STATUS_DATE) && ISNULL(FEEPAYER) && FEEPAYER == "N" && FEEPAYER == " ") && (FEEPAYER == "Y") ? 0 : 1

But it is not returning the desired results.

i want to return 0 if

Status_Data is NULL, Feepayer is NULL, Feepayer = N, FEEPAYER is empty

I want to return 1 if

FEEPAYER = Y

can someone tell me where i am going wrong please

MCTS / MCITP certified

masterdineen
Aged Yak Warrior

550 Posts

Posted - 2011-01-17 : 11:44:21
Does anyone know where i can get some good examples on the web?
Go to Top of Page

masterdineen
Aged Yak Warrior

550 Posts

Posted - 2011-01-18 : 06:46:05
Can anyone help at all?
Go to Top of Page

Stamey
Starting Member

14 Posts

Posted - 2011-02-01 : 13:54:16
This is about as close as I can get to your requirements. I used 3 variables in a package and the Expression Builder. The variables were called FeePayer, Status, and Test, with Test having the expression in it.
IsNull(@[User::Status]) ==True?"0": IsNull( @[User::FeePayer]) ==True? "0": @[User::FeePayer] == "N"? "0": @[User::FeePayer] == "Y"? "1": "0"

It evaluates correctly if Status is "Y", then evaluates if FeePayer Is Null, and if not, if it = "N", and if not, if it = "Y", and returns a "1" if it does, otherwise it returns a "0".
I was unable to evaluate the Null and "Empty" in the scope of variables.


Chris
Go to Top of Page
   

- Advertisement -