[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 615
  • Last Modified:

Case statement in SSIS expression lingo

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
Gray5452
Asked:
Gray5452
  • 3
1 Solution
 
itcoupleCommented:
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
 
Gray5452Author Commented:
thanks, that is much appreciated Emil,,,would the brackets just go back to back?
0
 
itcoupleCommented:
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
 
itcoupleCommented:
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now