SSIS 2011 Denali Expression Task

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail
FacebooktwitterlinkedinrssyoutubeFacebooktwitterlinkedinrssyoutube

SSIS Denali 2011 CTP 3 released at 12 July 2011, you can get it from here,

If you try SSIS Denali you will see a new task in Control flow, named Expression Task.

In this post I’ll talk about the Expression Task;

Expression Task created to do assignment on package variables or parameters.

you can write any expression you want there and assign it to any variable or parameter.

for example this is sample expression :

@[User::PreviousMonth]= MONTH( DATEADD( "MM", -1, GETDATE()  )  )

This will assign previous month number to the PreviousMonth variable.

If you experienced previous version of SSIS, you remember that you can do same thing with resort of expression property of variables and set EvaluateAsExpression of that property to true.

So what is difference between Expression Task and previous method?

Actually the previous method is still working and you can use it, and Expression task didn’t do any new thing. But the operation of assigning an expression result to a variable was not isolated in a TASK, the Expression Tasks comes to perform this as a TASK.

this is sample of Expression Task usage:

create a package first, add Expression task from toolbox

also add a package variable of type Int32 in package scope, and name it as PreviousMonth,

then go to expression task editor, and write this expression there:

@[User::PreviousMonth]= MONTH( DATEADD( "MM", -1, GETDATE()  )  )

then add a breakpoint to PostExecute event of expression Task,

and run the package, now when package pause at breakpoint you can see the PreviousMonth variable value in the watch window

That’s It.

FacebooktwitterredditpinterestlinkedintumblrmailFacebooktwitterredditpinterestlinkedintumblrmail
FacebooktwitterlinkedinrssyoutubeFacebooktwitterlinkedinrssyoutube
Reza Rad on FacebookReza Rad on LinkedinReza Rad on TwitterReza Rad on Youtube
Reza Rad
Trainer, Consultant, Mentor
Reza Rad is a Microsoft Regional Director, an Author, Trainer, Speaker and Consultant. He has a BSc in Computer engineering; he has more than 20 years’ experience in data analysis, BI, databases, programming, and development mostly on Microsoft technologies. He is a Microsoft Data Platform MVP for nine continuous years (from 2011 till now) for his dedication in Microsoft BI. Reza is an active blogger and co-founder of RADACAD. Reza is also co-founder and co-organizer of Difinity conference in New Zealand.
His articles on different aspects of technologies, especially on MS BI, can be found on his blog: https://radacad.com/blog.
He wrote some books on MS SQL BI and also is writing some others, He was also an active member on online technical forums such as MSDN and Experts-Exchange, and was a moderator of MSDN SQL Server forums, and is an MCP, MCSE, and MCITP of BI. He is the leader of the New Zealand Business Intelligence users group. He is also the author of very popular book Power BI from Rookie to Rock Star, which is free with more than 1700 pages of content and the Power BI Pro Architecture published by Apress.
He is an International Speaker in Microsoft Ignite, Microsoft Business Applications Summit, Data Insight Summit, PASS Summit, SQL Saturday and SQL user groups. And He is a Microsoft Certified Trainer.
Reza’s passion is to help you find the best data solution, he is Data enthusiast.

Leave a Reply