Microsoft SQL Server 2005 Integration Services

Like the Script Task, the Script Component is a platform within a platform. The environment for the Script Component is very similar to the Script Task. It's the same Visual Studio development environment and provides all the nice bells and whistles, such as IntelliSense and integrated help. If you're unfamiliar with the Visual Studio Integrated Development Environment, a quick review of Chapter 15, "Using the Script Task," might be helpful before moving on.

The Script Component is an easy-to-use mechanism for writing specialized data transformations in Visual Basic .NET. The Script Component provides template functions that allow you to easily add adapter or transformation functionality to your data flow without having to know or understand the details of manipulating metadata and buffers. After you get past the initial and small learning curve of learning the specifics of the Script Component, you need only understand and write code specifically related to your problem domain. Also, the code for the project is stored inside the package so no special steps are needed to register the resulting component as is required for custom components.

The Script Component Is Performant

The Script Component is also quite performant. Traditionally, scripting has been associated with bad performancewith good reason because scripting engines have been late-binding interpreters. Because the Script Component compiles its code into a true .NET binary, it is much faster than JavaScript and VBScript engines. In various tests, the performance of the Script Component measures at or better than roughly 90% of similar components written in native code with the Precompile option enabled.

Building Proofs of Concept

The Script Component is also a valuable way to do proof-of-concept components. The code that you write in a Script Component does, for the most part, transfer nicely to a custom component if you decide to take that step. But, you can do it without having to concern yourself with all the project setup and assembly registration issues. Proving the code in the Script Component lets you get to the heart of the problem without all the fuss. It's also helpful when you want to rapidly build proof-of-concept packages or isolate performance problems in your environment. The Script Component can be used to generate testing data or simply simulate data reads from hardware that might be slowing down your data flow. Using a Script Component, you can eliminate the network bandwidth or hard drive bottlenecks to give you an accurate measurement of the data flow throughput. These varying applications of the Script Component make it a valuable solution implementation.

Accessing Unusual or Unsupported Sources

The Script Component really shines when you need to access data in an unusual or unsupported format or location. For example, a large percentage of corporate information is stored in employee Inboxes. There is currently no source adapter available for reading data from mailboxes. However, using the Script Component, it's very easy to retrieve email, tasks, or any other Microsoft Outlook objects into the data flow. The GetEmail.dtsx package in the S20-ScriptTransform sample solution contains the code that allows you to retrieve email from your Inbox. The following discussion shows how to create a source that reads your Outlook Inbox. You can follow along and create it as you read or just open the package from the Samples folder.

Категории