SSIS, Sql Server Integration Services, is a full functional development environment. Unfortunately when we are building a package, before register and release the package, we need to Log, trace or debug the script. This process is a MUST if we are using a script task, a task which give you the availability to work directly with C# or VB.NET.
Create a simple SSIS project and insert a Sequence Container, then in the sequence container insert a Script Task and choose the C# language.
Please don’t take care about my screenshot, I know the package fails, but because I toke a screenshot and I’m **lazy …
** This is just an example, ok?
Now let’s create a couple of Global Variables in our package and let’s call it: VARIABLE01 and VARIABLE02.
Finally let’s go to edit our script task (right click on the task, edit script in the properties).
Some C# code.
First of all in out package class let’s go to create a function that return our variable value.
And now, let’s write this if block in the main routine:
Now we are ready to view how we can interact with the users in the SSIS package.
It’s very important that in the main routine you assign a result for the package
execution, don’t forget!!
Write to the Log, to the Output or to the Windows.
Well, now we need to build our WriteLog function. We have 3 way to do that.
The first one is to write directly on the Log:
The second one is to write to the Output, so when you will run the package in the Business Intelligence IDE, you will see the message in the output console:
Or you can send a MessageBox: