Solved

Case statement in SSIS expression lingo

Posted on 2011-03-01
4
610 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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to read data from SQL server  to sharepoint 2013 ? 3 26
Currency in SQL? 2 32
SQL Select in Access 2003 3 27
SQL Recursion 6 20
It is helpful to note: This is a cosmetic update and is not required, but should help your reports look better for your boss.  This issue has manifested itself in SSRS version 3.0 is where I have seen this behavior in.  And this behavior is only see…
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

828 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