The most anticipated change to the Script Task and Script Component has certainly been the change from VSA to VSTA for developing the script code. As a result of this change, the script language is no longer limited to Visual Basic .NET; now developers can choose to code using Visual C# .NET instead. Virtually every introduction to Integration Services I’ve conducted generates at least one complaint from the audience about the lack of support for Visual C# .NET in SQL Server 2005, so I’m glad to see this capability added.

 

All the buzz I’ve seen around the Script Task and Script Component focuses on the C# capability, but misses other changes that I think are also important to know about. Let’s take a closer look at other features introduced in these items with SQL Server 2008 Integraton Services.

 

ReadOnlyVariables and ReadWriteVariables properties

In the editor, the ReadOnlyVariables and ReadWriteVariables in SQL Server 2005 required you to type in the variable names. You can still do this, but I always ask, why type when you can select an item from a list? It saves keystrokes, and more importantly, ensures a correct value! In SQL Server 2008 there is an ellipsis button to click which opens a Select Variables dialog box which displays all the variables in the System and User namespaces. The downside (at least in the November CTP in which I most recentely tested this feature) is that this list seems to be a bit random and you can’t sort by name or type.


Precompilation


The PrecompileScriptIntoBinaryCode property in SQL Server 2005 is removed in SQL Server 2008. The removal of this property means you no longer get the choice of whether to precompile the code before package execution (which gets better performance at the expense of a larger package) or to compile just-in-time.


The default behavior in SQL Server 2008 is to precompile your script. When you’re editing the script, a set of VSTA project files are created (or re-opened), but they are deleted from your hard disk and persisted only in the package.


Edit Script button (formerly known as the Design Script button)


This is such a little change, but it means a lot to me and I’m sure to a lot of others. While intellectually I understand that it doesn’t require a lot of physical effort to click the mouse a few extra times, I invariably am annoyed when I feel I’m clicking much more than necesary to accomplish a task or to reach a destination. With regard to the Script Task and Script Component, I appreciate that the Edit Script button is now on the first page of the editor. Hooray! What really happened here was the order of the pages was changed. In SQL Server 2005, the pages in the Editor are General, Script, and Expressions whereas, in SQL Server 2008, the pages are Script, General, and Expressions. Microsoft acknowledged that the most frequent reason people open the editor is to edit the script and thus shortened the path to get there.


Access to External Assemblies


If you want to add a reference to a DLL in your script in SQL Server 2005, the VSA interface limits access to external assemblies in the Windows\Microsoft.NET\Framework\v2.0.50727 folder on your development machine and to GAC or this folder on the machine running the package. The Add Reference dialog presents a list of DLLs which you can add to your script, but there is no way to browse to another location where you might prefer to (or must) store your DLLs.  Furthermore, there is no way to add a Web reference if you want to interact with a Web service. Instead, you have to create your own proxy class first, register the class on the dev and production machines, and then reference that class in your script. Not impossible, but lots of extra steps required.


In SQL Server 2008, the VSTA interface in the Script Task and Script Component makes development much easier. First, the Add Reference dialog box has all the tabs you’d expect in a full IDE – .NET, COM, Projects, Browse, and Recent. The key point here is you can browse to the location of the DLL you want to use now. Second, you have the ability to add a Web reference and thereby get the proxy class created automatically for you without having to go through all the steps required to get this behavior in SQL Server 2005. Jamie Thomson has posted a video demonstrating how to consume a Web service with VSTA in SQL Server 2008 Integration Services which you should check out if this sort of functionality is useful in your environment. –Stacia