SSIS 2011 Denali Expression Task

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.

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 12 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, Power BI Summit, and Data Insight Summit.
Reza is author of more than 14 books on Microsoft Business Intelligence, most of these books are published under Power BI category. Among these are books such as Power BI DAX Simplified, Pro Power BI Architecture, Power BI from Rookie to Rock Star, Power Query books series, Row-Level Security in Power BI and etc.
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.
His articles on different aspects of technologies, especially on MS BI, can be found on his blog: https://radacad.com/blog.

Leave a Reply