Beta Release - Please Report Issues
Who is online? 796 guests and 1 members
Member login | Become a member
home » blogs » DevinKnight » SSIS Expressions Basics
posted 11/7/2009 2:07:50 PM by DevinKnight
For those that are new to SSIS, using expressions may seem very foreign and unpleasant. Not only is it a new language for you to learn but new data types to understand as well. If you can get past this unwelcoming feelings you’ll realize using expressions is a great method for making your SSIS packages dynamic.
I will tell you about the basics you need to know before starting to use expressions. If you’re interested in a crash course on writing expressions read this White Paper by Brian Knight . http://www.pragmaticworks.com/downloads/ssisexpressionswhitepaper/
Using expressions isn’t nearly as difficult as many believe. Provided to you is the Expression Builder that will save many hours of
research on the web trying to determine which function you need for what you’re trying to accomplish. Luckily you can skip this research step because all the possible functions you can use are located in the Expressions Builder.
There are a variety of places in SSIS where you have the ability to make a package dynamic using expressions. Connection managers and tasks have options for building expressions to dynamically change the value of a property. For example, a very common use for expression in connection managers involves using a Foreach Loop Container with the Foreach File Enumerator. This involves looping through a collection of files and performing the same tasks (usually loading to a table) to each file. You would use expressions in this case to change the value of the connection string property in the connection manager that stores the file location so after each iteration of the loop you’re loading a new file.
Expressions are not exclusive to connection managers and tasks. Variables also have the ability to use expression to change how they will evaluate. Selecting a variable and changing the EvaluateAsExpression property of the variable to True will all for this variable to dynamically change at runtime. This opens up many possibilities to any object in your package that may want to use variables with.
Of course it must be mentioned that there are Data Flow transforms that require basic knowledge of expressions. Derived Column and Conditional Split are just a couple of the transforms that require the expressions language to do business. Using expressions in transforms like these are not necessarily making your package dynamic but they could make your data dynamic. Expression in transforms can restrict what rows are loaded, change the value in rows, or even replace the value in rows.
DevinKnight (Member since: 10/27/2009 11:25:07 AM) Devin (MCTS) is a Senior BI consultant at Pragmatic Works Consulting. Previously, he has tech edited the book Professional Microsoft SQL Server 2008 Integration Services and was an author in the book Knight's 24-Hour Trainer: Microsoft SQL Server 2008 Integration Services. Devin has spoken at past conferences like PASS and at several SQL Saturday events. He is a contributing member to the Business Intelligence Special Interest Group (SIG) for PASS as a leader in the SSIS Focus Group. Making his home in Jacksonville, FL, Devin helps run his local users’ group (JSSUG) as a Vice President.
View DevinKnight 's profile
Comment (No HTML)
It's fast, easy and free! Submit articles, get your own blog, ask questions & give answers in the forums, and become a better developer, faster.
enter your email address: