次の方法で共有


ExecutionDuration プロパティ

コンテナが実行中に費やした時間をミリ秒単位で示す値を返します。このプロパティは読み取り専用です。

名前空間:  Microsoft.SqlServer.Dts.Runtime
アセンブリ:  Microsoft.SqlServer.ManagedDTS (Microsoft.SqlServer.ManagedDTS.dll)

構文

'宣言
Public ReadOnly Property ExecutionDuration As Integer
    Get
'使用
Dim instance As DtsContainer
Dim value As Integer

value = instance.ExecutionDuration
public int ExecutionDuration { get; }
public:
virtual property int ExecutionDuration {
    int get () sealed;
}
abstract ExecutionDuration : int
override ExecutionDuration : int
final function get ExecutionDuration () : int

プロパティ値

型: System. . :: . .Int32
コンテナが実行に費やした時間を表す Integer です。時間は、ミリ秒単位で指定されます。

実装

IDTSExecutionMetrics. . :: . .ExecutionDuration

使用例

次のコード例では、既存のパッケージを実行し、そのパッケージが実行された時間をミリ秒単位で示します。また、出力では、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

サンプルの出力 :

ExecutionDuration: 0

ExecutionDuration: 172

ExecutionResult: Success