SSIS - MonthName and Day Name in SSIS

Scenario:

Some time we have requirement to send email with MonthName or dayName in the subject in SSIS Package or need to create folder with Month Name and then Archive files e.g. Archive_Dec_2011. How we can create folder or have subject in email with Month Name or Day Name by using SSIS Package?


Solution:

We don't have Month-Name or Day-Name in SSIS Package.We can create two variables in our package and write expressions on them to use them wherever we need Month Name and Day Name.


Step 1:
Let's create VarDayName and VarMonthName variables in our SSIS Package so we can write expressions on them and use in our Package where we need Month Name an Day Name.

How to get Month Name and Day Name in SSIS Package - SSIS Tutorial for Beginners




Step 2: 
Go to the properties of VarDayName variable and then configure as shown below.


Write expression to get Day Name in SSIS Package - SSIS Tutorial

Expressions for Month Name:
DATEPART("dw",GETDATE())==1? "Sunday":
DATEPART("dw",GETDATE())==2?"Monday":
DATEPART("dw",GETDATE())==3?"Tuesday":
DATEPART("dw",GETDATE())==4?"Wednesday":
DATEPART("dw",GETDATE())==5?"Thursday":
DATEPART("dw",GETDATE())==6?"Friday":
DATEPART("dw",GETDATE())==7?"Saturday":""


Step 3:

Go to the properties of DayMonthName variable and write expressions as shown below.



Expressions for Month Name:
(MONTH(getdate()) == 1 ? "Jan" :
MONTH(getdate()) == 2 ? "Feb" :
MONTH(getdate()) == 3 ? "Mar" :
MONTH(getdate()) == 4 ? "Apr" :
MONTH(getdate()) == 5 ? "May" :
MONTH(getdate()) == 6 ? "Jun" :
MONTH(getdate()) == 7 ? "Jul" :
MONTH(getdate()) == 8 ? "Aug" :
MONTH(getdate()) == 9 ? "Sep" :
MONTH(getdate()) == 10 ? "Oct" :
MONTH(getdate()) == 11 ? "Nov" :
MONTH(getdate()) == 12? "Dec":"")



Now you have Month Name and DayName available through these two variables ,
Those can be used in expression with different transformations as required.


Related Posts
How To Use Expression Task To Get Day Name and Month Name In SSIS Package
Video Demo : How to use Expression Task to get Month Name in SSIS Package