Chapter 15. Using the Script Task


In This Chapter

  • The Script Task Environment

  • Using the Script Task

  • Script Task Samples

"THAT'S SO COOL, MAN!"

ASHVINI SHARMA

The Script Task warrants an entire chapter because it is such an important part of the flexibility and extensibility model for Integration Services. Integration Services ships with a rich set of tasks covering a broad range of features, but there always seem to be a few things people want to do in their packages that the stock tasks don't support. The Script Task nicely fills the holes left by the stock tasks and sports its own Visual Studio Designer with a rich set of development bells and whistles, such as object browsing and IntelliSense. If you are only familiar with the DTS ActiveX Task, you are in for a pleasant surprise.

The Script Task gives you access to the full power of .NET coding. It is not scripting, so it has probably been misnamed, but truly compiles the code, giving you a much faster resulting task. You can reference other assemblies, precompile the code, and even work with the Integration Services object model to build other packages. The Integration Services team tried to mitigate the need for coding solutions. By most accounts, they've done a pretty good job, but there are still occasions when you need to break down and write some code. Following are some situations when you might consider using a Script Task:

  • No task exists that supports the behavior you need.

  • You need to accomplish some simple workflow.

  • You will not be using the same code in multiple locations in the package or in multiple packages.

  • You need to prototype a custom task.

  • You don't care if someone else can see the code.

  • You don't have any sensitive information to store in the task.

Caution

In DTS, it was common to use an ActiveX Script Task to self-modify the package that hosted the task. The Script Task is not capable of modifying its host package and has no access to the package in which it exists.


Generally speaking, if you need to use the logic in more than one location or you have security concerns with the kind of data the task will be manipulating, it is better to build a custom task. Custom tasks are much easier to reuse and are not much harder to build than the Script Task.



Microsoft SQL Server 2005 Integration Services
Microsoft SQL Server 2005 Integration Services
ISBN: 0672327813
EAN: 2147483647
Year: 2006
Pages: 200
Authors: Kirk Haselden

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net