SSIS - How to Write Case Statement In SSIS Package

Scenario:

We have received a text source file that has the abbreviation for Region Code. We want to convert these region codes to region name such as

If RegionCode is AS then RegionName="ASIA'

If RegionCode is NA then RegionName="NORTH AMERICA'

If RegionCode is EU then RegionName="EUROPE'

If non of above them "UNKNOWN".

Fig 1: Text Source File with ClientRegion

Solution: 

If this data would be in table we could have write a query with case statement like below

Select id,Name,ClientRegion, 
Case 
When ClientRegion='AS' THEN 'ASIA'
WHEN ClientRegion='NA' THEN 'NORTH AMERICA'
WHEN ClientRegion='EU' THEN 'EUROPE'
ELSE 'UNKNOWN' END AS RegionName
from dbo.Client

As we are reading the data from text file we can't write the TSQL statement. We can load this data to some table and then write the statement but we don't want to do that. We will use Derived Column Transformation to write expression to get our Region Name.

Step 1: 

Create your SSIS Package. Inside the SSIS Package, Bring Data Flow Task. As we need to read the data from text file, Bring Flat File Source and create connection to source file.

Once the connection is created, Bring Derived Column Transformation and connect to Flat File Source and write expressions as given below. These expressions will give us the results like our Case statement. 

ClientRegion == "AS" ? "ASIA" : ClientRegion == "NA" ? "NORTH AMERICA" : ClientRegion == "EU" ? "EUROPE" : "UNKNOWN"

Fig 2: Write Case Statement in Derived Column Transformation in SSIS Package

Step 2: 

Bring Multicast Transformation as test destination and then connect Derived Column Transformation to it. Add the Data Viewer so we can see the output. Run the SSIS Package and see the output.
Fig 3:Write Case Statement in SSIS Package By Using Derived Column Transformation


As we can see that the expression worked as expected.




46 comments:

  1. Nowadays, data has powerful capabilities that can transform your business’s face, especially when the competition is all around. Interested to know more about data intelligence, check out https://www.inetsoft.com

    ReplyDelete
  2. Nice post. I was checking constantly this blog and I’m impressed! Extremely useful info specially the last part I care for such information a lot. I was seeking this certain info for a long time. Thank you and good luck.write for us

    ReplyDelete
  3. Shop beautiful womens cashmere sweaters, cardigans and scarves. Chic and stylish. Made in EU. Free shipping worldwide. cashmere long cardigan

    ReplyDelete
  4. Tours | Blogging Journey for beginner's provides the guide of Blogging, WordPress, SEO, Affiliates, Hosting, Theme, and online... Best Page Builder Plugins

    ReplyDelete
  5. Urban VPN MOD APK is a great VPN and all of their users share their network resources to help each other unlock the Internet. Urban VPN MOD APK

    ReplyDelete
  6. Royal Tangkas is one of the favorite agile gambling games because it has a simple and fast style of play. royaltangkas

    ReplyDelete
  7. Sbowin & Joinsbo is an official Sbobet alternative link site that is also the most famous, especially in Indonesia. login sbobet

    ReplyDelete
  8. Welcome to the 389Sports real money online idn poker site, we as idn play agents as the official online poker site always prioritize service and game quality for members when playing. If you are interested in playing real money idn poker gambling, poker uang asli

    ReplyDelete
  9. Such sites are important because they provide a large dose of useful information ... Satta king 786

    ReplyDelete
  10. The 389Sports site is certainly able to compete with other soccer betting sites by comparing the quality of service and security. In addition, by having a game ID at 389Sports you can not only play soccer, you can also play hundreds of other online gambling games tangkas online

    ReplyDelete

  11. Wonderful article. I love your style of writing. It's inspiring , and I am happy with your writing style. Visit my website.
    Black satta

    ReplyDelete
  12. Keep your expectations low
    In case you're participating in the Satta king fast and Matka games for the essential time then, at that point, keep the assumption for winning absolute bottom. Maybe you wish to do the Satta King 786 different times, notwithstanding how that is anyway exclusively you might be prepared to win.

    ReplyDelete
  13. SBOBET ASIA as a trusted sbobet agent started its work in 2009 operating on the Isle of Man and became the first official operator to be allowed to open a live dealer casino in Southeast Asia. sbobet asia

    ReplyDelete
  14. 389Sports situs resmi agen joker123 dan joker388, download aplikasi joker123 apk, link alternatif, deposit via pulsa 25 ribu tanpa potongan. joker388

    ReplyDelete
  15. Welcome to the online ceme bookie389Sports, prospective members and active members will get comfort and satisfaction in playing and joining our gambling site. If you want to play online ceme betting, then you can visit the 389Sports agent who has been trusted to be the official ceme site in Indonesia for years. You can immediately choose and join 389Sports ceme deposit pusla

    ReplyDelete
  16. By playing using the official site, you can get many benefits, such as playing hundreds of online slot games with only 1 ID, the Joker Shoot Fish Online site 389Sports also always guarantees your safety and comfort when playing. joker123 deposit pulsa

    ReplyDelete
  17. Trusted online capsa stacking gambling site 389sports, playing capsun online, deposit 25 thousand via credit & e-wallet, 10% new member bonus. capsa uang asli

    ReplyDelete
  18. How to play Satta King game?
    With the advancement of technology, the rules of the game are also changing. A lot of differences have been noticed between the previous Satta King games and the current games. In the past, some Satta number written on pieces of paper were placed in containers or pots. The person who chooses the correct number is declared the Satta king. That means the person is the winner. Nowadays people like to play pc games. Choose the game and start playing.

    ReplyDelete
  19. The online fish shooting gambling game or fishing game itself is now available and you can play on a 389Sports site that offers online fish shooting gambling games or fishing games. Over time, the online fish shooting gambling game has become a very popular game. This is because the game itself is very colorful and interesting for bettors to play tembak ikan online

    ReplyDelete
  20. hubslotjoker info. HUBJOKER888 . Online slots on mobile phones. HUBJOKER888 , new online slots website, Joker, Auto top-up system, deposit ... joker สล็อต

    ReplyDelete
  21. These online slots games are very popular. and has the most players since Slotxo app has opened for service As an example, it can be seen that the online slots games from SLOTXO have different game themes. Whether it's a Safari style, a Chinese style, a hero style and many other genres that are waiting for you to open up a new experience in playing online slots. pg slot

    ReplyDelete
  22. best football odds This must be accepted that For anyone who wants to play football betting Really need this camp because the water price is up to 4 bucks. You have to understand that first. To press the ball will be very profitable, it depends on the goal scoring odds. ufa th

    ReplyDelete
  23. The most popular gambling game with 10 famous gambling companies such as 1. PG SOFT 2. Pragmatic Play 3. Joker Gaming 4. Habanero 5. Dragoon Soft 6 สล็อต

    ReplyDelete
  24. free credit, no deposit required, no sharing Web activities throughout the month Whether it's free credit giveaways, birthday giveaways, pg slots and many other great events Looking forward to having fun here. pg slot

    ReplyDelete
  25. ll casino games on SAGAME88 have a minimum bet of only 5 baht, a maximum of 1,000,000 baht, a minimum deposit of 1 baht, fast auto-deposit system, 24-hour care team. คาสิโนออนไลน์ สล็อต

    ReplyDelete
  26. Football betting, the most popular UFABET football betting website at the national level, the direct website does not go through the agent, deposit-withdraw, no minimum, fast, ready to serve 24 hours a day. ไพ่แคง ออนไลน์

    ReplyDelete
  27. Celebrating hundreds of thousands of members across the country Ibiza Club 88 online gambling website with casino games from all camps gathered in one place, Sexy Gaming, PG Slot, SA Gaming, Pokdeng, card games, football, lottery ... บาคาร่า มือถือ

    ReplyDelete
  28. This comment has been removed by the author.

    ReplyDelete
  29. How to apply for slot xo with 3 easy steps Friends can play slots (Slot Online). The team has prepared a method for applying for slots. can apply through the website Register for online slots ดาวน์โหลดpg slot

    ReplyDelete
  30. Deposit and withdraw with a reliable automated system There are more than 100,000 users per day. Unlimited deposits-withdrawals. Login to play online slots here 55xo ... joker สล็อต

    ReplyDelete
  31. This is what I’ve been searching for days. Extremely useful. Thank you for sharing! สล็อตPG aoom123.

    ReplyDelete
  32. These are some great tools that i definitely use for SEO work. This is a great list to use in the future..
    dg

    ReplyDelete
  33. Vue.ai’s product recommendation engine tracks website shoppers' behaviour based on their user behaviour. We tracked their historical and live data and based on that we provide product recommendations to them. Every shopper should delight in getting an individualized shopper experience. personalized recommendations that convert 120% better.
    Drive growth with personalized product recommendation engine. Make every customer feel special with 1:1 curated & personalized recommendations that convert 120% better.A personalized experience at every touchpoint. Delight every shopper with truly individualized shopper experiences and grow your revenue.

    ReplyDelete
  34. เกมออนไลน์ที่ได้รับความนิยมมากที่สุดในตอนนี้ปี 2022
    joker slot
    joker gmaing

    ReplyDelete
  35. Thank you very much for writing such an interesting article on this topic. This has really made me think and I hope to read more. 918kisspg.com

    ReplyDelete
  36. Hi there! You make so many good points here that I read your article a couple of times. This is really nice content for your readers. MCCQE part 2

    ReplyDelete
  37. "I am extremely impressed along with your writing talents as well as with the structure for your blog.
    สล็อต66 สล็อตxo สล็อต11"

    ReplyDelete
  38. I will right away clutch your rss as I can’t find your email subscription link or e-newsletter service. Do you have any? Please let me realize so that I could subscribe. Thanks. I will right away clutch your rss as I can’t find your email subscription link or e-newsletter service. Do you have any? Please let me realize so that I could subscribe. Thanks.

    ReplyDelete
  39. Koçak Vize Vize Hizmetleri Vize işlemleri Elçiliğe Gitmeden Vize Alma Online Vize Başvurusu İşlemleri Vize Danışmanlık Firması olarak hizmetinizdeyiz Finlandiya vizesi

    ReplyDelete
  40. Because I can't find your email subscription link or e-newsletter service, I'll immediately grab your rss. Have you got any? Please let me understand so I can subscribe. Thanks. Because I can't find your email subscription link or e-newsletter service, I'll immediately grab your rss. Have you got any? Please let me understand so I can subscribe. Thanks. wool socks

    ReplyDelete
  41. Al Khawaneej has several moving companies that cater to both residential and commercial moves. To ensure a well-informed decision, it is recommended to conduct research and compare different options based on factors like pricing, reputation, and available services. For more visit Al Khawaneej

    ReplyDelete
  42. There are many ways to earn money in Pakistan. Many simple and complicated ways are also available. Today I will tell you the easiest way Earning money by watching adds .

    ReplyDelete
  43. Local SEO is a search engine optimization strategy that helps your business be more visible in local search results on Google. Local SEO play an important role to rank your business. You can rank your site at local area. visit: https://mnseoultrapro.com/local-seo-services/

    ReplyDelete
  44. Do you want to stay healthy follow these steps and enjoy a sound life. You can visit https://www.ericlcox.com/

    ReplyDelete
  45. Hello guys. That a great article from data management point of view. I got really a great information from here and implement on my site related to urn for ashes

    ReplyDelete
  46. Very good points you wrote here..Great stuff...I think you've made some truly interesting points.Keep up the good work. best yoga teacher training programs in Goa

    ReplyDelete