Using Variable in IF Clause in Execute SQL Task in SSIS Package - SQL Server Integration Services (SSIS) Tutorial

Scenario:

How to run the different parts of SQL Statements depending upon the values of variable. Depending upon the value of variable we will be executing different parts of SQL Statements inside Execute SQL Task.

In this video of learning about Execute SQL Task , we will learn following Items

  • How to Create SSIS package from Scratch
  • How to create an variable in SSIS Package
  • How to use variable in expressions to build sql statement in Execute SQL Task.
  • How to use variable to run specific part of SQL inside Execute SQL Task



Expressions used in the Video to build IF clause by using Variable values from SSIS Package

"DECLARE @RegionCode VARCHAR(2)
SET @RegionCode='"+ @[User::RegionCD]+"'

If @RegionCode='EU'
BEGIN
insert into dbo.Customer_EU
Select * from dbo.Customer_NA

END

If @RegionCode='NA'
BEGIN
Truncate table dbo.Customer_NA
END
 "



How to use Variable in IF clause in Execute SQL Task in SSIS Package



 Related Posts / Videos on Execute SQL Task 

1 comment:

  1. TODAY I GOT MY DESIRED XMAS LOAN AMOUNT $520,000.00 FROM A RELIABLE AND TRUSTED LOAN COMPANY. IF YOU NEED A LOAN NOW EMAIL CONTACT drbenjaminfinance@gmail.com

    Hello, I'm here to testify of how i got my loan from BENJAMIN LOAN FINANCE(drbenjaminfinance@gmail.com) I don't know if you are in need of an urgent loan to pay bills, start business or build a house, they offer all kinds of loan. So feel free to contact Dr. Benjamin Owen he holds all of the information about how to obtain money quickly and painlessly without cost/stress via Email: drbenjaminfinance@gmail.com

    Consider all your financial problems tackled and solved ASAP. Share this to help a soul right now THANKS.

    ReplyDelete