2.1. Script Tasks and Custom Libraries

Script Tasks are valuable tasks for handling custom functionality because code can be written within the task. But when you want to use the same code over and over again, why rewrite or cut and paste code for each Script Task? A good developer knows that code re-use makes developing code efficient and easier to maintain. That is why it is a good practice to build custom libraries so that they can be used as functional components as well as building blocks within Script Tasks.

Code reusability is also a great case for writing custom components. However, your code may not be suitable for a custom component because of its unique variability, or perhaps your company policies prevent registering such components on your servers. In these cases, the Script Task is probably the right solution, and with custom libraries, you are still able to consolidate redundant code.

2.1.1. User-Defined Variables

Variables are primarily used as configuration settings within SSIS during runtime. Using variables allows packages to be configured dynamically, rather than having to hard-code settings in the package. There are system variables that are defined by SSIS, and user-defined variables that developers build for their own settings (which a package may use dynamically). Creating user-defined variables and then using them from within Script Task variables is very powerful for dynamic package settings. User-defined variables are created within BIDS and can be ...

Get Expert SQL Server™ 2005 Integration Services now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.