Here’s a simple way to show the values of variables in an SSIS package. This will allow you an easy way to view whatever variables or parameters you want to see in the progress or execution results of a package. It will also be visible in the Execution Report in the Integration Services Catalogs. This is something that is really going to help with troubleshooting, whether it is during development or even in production.

  1. Create a script task in your package. Give it a name, like “Display Variables.”
  2. Edit the script task. Make sure the language is set to Microsoft Visual C#.
  3. In the ReadOnlyVariables, select all of the variables you want to see as Information output. They can be user, package, or project.
  4. Click Edit Script and add the following code. Make sure to add it inside the Public main() – make it look like this:
public void Main()
{
 int dtsVarCount = Dts.Variables.Count;
 bool refFalse = false;

 for (int i = 0; i < dtsVarCount; i++)
 {
  Dts.Events.FireInformation(0, "Variables"
   , Dts.Variables[i].Name.ToString() 
   + ": " 
   + Dts.Variables[i].Value
   , null
   , 0
   , ref refFalse);
 }

 Dts.TaskResult = (int)ScriptResults.Success;
}

The code loops through each of the variables that were selected in the task, displaying the name of the variable and the value. Simple as that!

This will produce the following messages in Progress/Execution Results in Visual Studio (click the pic for a better look):

In an Execution Report from Integration Services Catalog, you would find it under All Messages (click the pic for a better look):