Solved

Case statement in SSIS expression lingo

Posted on 2011-03-01
4
612 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Turn Insights into Action

Communication across every corner of your business is essential to increase the velocity of your application delivery and support pipeline. Automate, standardize, and contextualize your communication processes with xMatters.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

717 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