Shorthand Month in SSIS Expression

Need a quick way to get the shorthand version (Mmm) of a month in a SSIS expression? Copy and paste the following into a variable and you have precisely just that.

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" :"Dec"

A quick code snippet to hopefully save you a couple of minutes of typing.

Happy Coding!

Releated Post

Leave a Reply

%d bloggers like this: