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.




38 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. Welcome to Trophy Monster, the online store for the champion in all of us. Get personalised trophies, medals and awards for events of all kinds, ... trophy store

    ReplyDelete

  12. 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
  13. 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
  14. 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
  15. 389Sports situs resmi agen joker123 dan joker388, download aplikasi joker123 apk, link alternatif, deposit via pulsa 25 ribu tanpa potongan. joker388

    ReplyDelete
  16. 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
  17. 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
  18. 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
  19. 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
  20. 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
  21. hubslotjoker info. HUBJOKER888 . Online slots on mobile phones. HUBJOKER888 , new online slots website, Joker, Auto top-up system, deposit ... joker สล็อต

    ReplyDelete
  22. 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
  23. 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
  24. 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
  25. 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
  26. 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
  27. 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
  28. 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
  29. This comment has been removed by the author.

    ReplyDelete
  30. 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
  31. 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
  32. This is what I’ve been searching for days. Extremely useful. Thank you for sharing! สล็อตPG aoom123.

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

    ReplyDelete
  34. 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
  35. เกมออนไลน์ที่ได้รับความนิยมมากที่สุดในตอนนี้ปี 2022
    joker slot
    joker gmaing

    ReplyDelete
  36. Betta fish for sale, we’re selling betta fish online. We live in Thailand and our goal is exporting all our top quality bettas to WORLDWIDE!! betta fish for sale

    ReplyDelete
  37. 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
  38. เข้ามาสนุกสนาน เว็บสล็อต สายตรง กับการเดิมพัน ที่ปลอดภัย มีความพิเศษ ไม่เหมือนใคร ในเรื่องของการ ให้บริการ เกมสล็อต รวมทุกค่าย สามารถทำเงิน จากการเล่น ได้สูงกว่าเว็บอื่น

    ReplyDelete