DtsContainer.ExecutionDuration Property

 

Applies To: SQL Server 2016 Preview

Returns a value that indicates the amount of time that the container spent in execution, in milliseconds. This property is read-only.

Namespace:   Microsoft.SqlServer.Dts.Runtime
Assembly:  Microsoft.SqlServer.ManagedDTS (in Microsoft.SqlServer.ManagedDTS.dll)

Syntax

public int ExecutionDuration { get; }
public:
property int ExecutionDuration {
    virtual int get() sealed;
}
abstract ExecutionDuration : int with get
override ExecutionDuration : int with get
Public ReadOnly Property ExecutionDuration As Integer

Property Value

Type: System.Int32

An Integer that contains the time that the container spent executing. The time is given in milliseconds.

Implements

IDTSExecutionMetrics.ExecutionDuration

Examples

Legacy Code Example

The following code example runs an existing package, then shows how long the package ran, in milliseconds. The output also displays the ExecutionResult.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;

namespace Microsoft.SqlServer.SSIS.Samples
{
    class Program
    {
        static void Main(string[] args)
        {
            // The package is the ExecuteProcess package sample 
            // that is installed with the SSIS samples.
            string pkg = @"C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\ExecuteProcess Sample\ExecuteProcess\bin\UsingExecuteProcess.dtsx";

            Application app = new Application();
            Package p1 = app.LoadPackage(pkg, null);

            // Show the properties inherited from DtsContainer.
            Console.WriteLine("ExecutionDuration:    {0}", p1.ExecutionDuration);

            // Run the package, then review the execution duration.
            p1.Execute();
            Console.WriteLine("ExecutionDuration:    {0}", p1.ExecutionDuration);
            // Also, review the execution result.
            Console.WriteLine("ExecutionResult:   {0}", p1.ExecutionResult);
        }
    }
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime
 
Namespace Microsoft.SqlServer.SSIS.Samples
    Class Program
        Shared  Sub Main(ByVal args() As String)
            ' The package is the ExecuteProcess package sample 
            ' that is installed with the SSIS samples.
            Dim pkg As String =  "C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\ExecuteProcess Sample\ExecuteProcess\bin\UsingExecuteProcess.dtsx" 
 
            Dim app As Application =  New Application() 
            Dim p1 As Package =  app.LoadPackage(pkg,Nothing) 
 
            ' Show the properties inherited from DtsContainer.
            Console.WriteLine("ExecutionDuration:    {0}", p1.ExecutionDuration)
 
            ' Run the package, then review the execution duration.
            p1.Execute()
            Console.WriteLine("ExecutionDuration:    {0}", p1.ExecutionDuration)
            ' Also, review the execution result.
            Console.WriteLine("ExecutionResult:   {0}", p1.ExecutionResult)
        End Sub
    End Class
End Namespace

Sample Output:

ExecutionDuration: 0

ExecutionDuration: 172

ExecutionResult: Success

See Also

DtsContainer Class
Microsoft.SqlServer.Dts.Runtime Namespace

Return to top