Solved

Case statement in SSIS expression lingo

Posted on 2011-03-01
4
606 Views
Last Modified: 2012-05-11
What’s the expression language within a derived column transform to do CASE type stuff…

Basically, I’m adding a column that is a retainer percent that adjusts client spend based on date so if

Tape_aired < 1/31/11 then RetainerPerc                                                               =  .97 for that row
Tape_aired between 1/31/11 and 2/15/11 then RetainerPerc                      = .984 for that row
Tape_aired between 2/15/11 and 3/30/11 then RetainerPerc                      = .992 for that row


THanks all as this site has been amazing for me...
0
Comment
Question by:Gray5452
  • 3
4 Comments
 
LVL 10

Expert Comment

by:itcouple
ID: 35007623
Hi

This should help
http://www.itcouple.com/ssis-if.aspx

You can nest them using brackets... Let me know if you need an example (I actually need to post an example the above page with nesting).

Hope that helps
Emil
0
 

Author Comment

by:Gray5452
ID: 35007785
thanks, that is much appreciated Emil,,,would the brackets just go back to back?
0
 
LVL 10

Expert Comment

by:itcouple
ID: 35007904
I'm not sure if typed it correctly but below should give you the answer:

(Field==2?1:(Field==3?1:2))

Regards
Emil
0
 
LVL 10

Accepted Solution

by:
itcouple earned 500 total points
ID: 35008588
Hi

I updated my link (will publish tonight) and below is an example for you

(DateField < "2011-01-01" ? 0.5 : (DateField >= "2011-01-01" && DateField <= "2011-02-28" ? 0.75 : 1))

I haven't tested in with actual table so you might have to do some cast to date. Also third condition I put as else instead of your final range so you might want to change that.

Regards
Emil
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now