SQL Server Integration Services (SSIS) - ActiveX Script task container

Introduction

In this article we are going to see how to use an ActiveX Script task container in SSIS packaging. Here we take some simple example of executing a VB Script at runtime using the ActiveX Script task container. This task container is mostly used when we move the SQL 2000 DTS objects to SSIS packaging. So this task container is used to customize our process of writing script and executing those scripts at runtime. Let's see a simple example of how to use this task and execute a script.

To follow my series of articles on SSIS packages refer to the URLs shown below:

Steps:

Follow steps 1 to 3 on my first article to open the BIDS project and select the right project to work on an integration services project. Once the project is created, we will see how to use ActiveX Script task container and execute a script.

Drag and drop the ActiveX script task container as shown in the screen below.



Now in order to execute a script at the start of the SSIS Package we need to provide the startup script to the script container. To provide the script, right click on the ActiveX script task and select Edit. It will show a window as shown in the screen below.



Move on to the SCRIPT tab, which is the main section we need to concentrate on since we are going to write the script in this section.  Here we have 2 sections; one is

LANGUAGE – in this section we need to provide which scripting language we are going to write the script in.

SCRIPT – in this section we are going to click on the right; just click on the button at the right side; it will open a window to write the script as shown in the screen below.



Here I have written a bit of code to write a string to a file as shown in the screen below.



ENTRY POINT – You need to provide an entry point for the script, in our case you need to give it as MAIN().

Once we have written the script, now click on OK; it will move back to the previous screen. In that screen at the bottom you can see an option like PARSE. Clicking on that button will check the syntax and give the result as shown below.



Once all the configurations are over, now we need to execute the package and see if the script has been executed perfectly. To do that right click on the ActiveX Script task and give execute task as shown in the screen below.



It will show the result as shown in the screen below.



And the result is that a file will be created at the location specified as shown in the screen below.


Similar Articles