ResultSetType 列挙型

定義

SQL 実行タスクが使用できる結果セットの種類を定義します。

public enum class ResultSetType
public enum ResultSetType
type ResultSetType = 
Public Enum ResultSetType
継承
ResultSetType

フィールド

ResultSetType_None 1

SQL ステートメントが結果セットを返さないように指定します。 たとえば、テーブル内のレコードを追加、変更、または削除するクエリでこの結果セットが使用されます。

ResultSetType_Rowset 3

結果セットが複数の行になるように指定します。 たとえば、テーブル内のすべての行を取得する SELECT ステートメントでこの結果セットが使用されます。

ResultSetType_SingleRow 2

結果セットが単一行になるように指定します。 たとえば、リターン コードを返すストアド プロシージャやカウントや合計を返す SELECT ステートメントでこの結果セットが使用されます。

ResultSetType_XML 4

クエリが結果セットを XML 形式で返すときに XML 結果セットが使用されるように指定します。 たとえば、FOR XML 句を含む SELECT ステートメントでこの結果セットが使用されます。

次の例では、まず ExecuteSQLTask を作成し、次にプロパティの既定の設定を示します。 その後、この列挙を使用する ResultSetType を含む、いくつかのプロパティの値を設定し、プロパティ値の設定方法を示します。

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

namespace Microsoft.SqlServer.SSIS.Samples  
{  
    class Program  
    {  
        static void Main(string[] args)  
        {  
            Package pkg = new Package();  
            Executable exec1 = pkg.Executables.Add("STOCK:SQLTask");  
            TaskHost th = exec1 as TaskHost;  

            // List the default values of the Execute SQL task  
            // using the Properties collection of the TaskHost.  
            Console.WriteLine("BypassPrepare          {0}", th.Properties["BypassPrepare"].GetValue(th));  
            Console.WriteLine("CodePage               {0}", th.Properties["Connection"].GetValue(th));  
            Console.WriteLine("Connection             {0}", th.Properties["Connection"].GetValue(th));  
            Console.WriteLine("ExecutionValue         {0}", th.Properties["ExecutionValue"].GetValue(th));  
            Console.WriteLine("IsStoredProcedure      {0}", th.Properties["IsStoredProcedure"].GetValue(th));  
            Console.WriteLine("ParameterBindings      {0}", th.Properties["ParameterBindings"].GetValue(th));  
            Console.WriteLine("ResultSetBindings      {0}", th.Properties["ResultSetBindings"].GetValue(th));  
            Console.WriteLine("ResultSetType          {0}", th.Properties["ResultSetType"].GetValue(th));  
            Console.WriteLine("SqlStatementSource     {0}", th.Properties["SqlStatementSource"].GetValue(th));  
            Console.WriteLine("SqlStatementSourceType {0}", th.Properties["SqlStatementSourceType"].GetValue(th));  
            Console.WriteLine("TimeOut                {0}", th.Properties["TimeOut"].GetValue(th));  

            Console.WriteLine("--------------------------");  
            // Show how to set a property using the TaskHost Properties.  
            Variable myVar = pkg.Variables.Add("myVar", false, "User", 100);  
            th.Properties["SqlStatementSourceType"].SetValue(th, SqlStatementSourceType.Variable);  
            th.Properties["SqlStatementSource"].SetValue(th, "myVar");  
            th.Properties["ResultSetType"].SetValue(th, ResultSetType.ResultSetType_XML);  

            Console.WriteLine("New value of Source and SourceType:  {0}, {1}", th.Properties["SqlStatementSource"].GetValue(th), th.Properties["SqlStatementSourceType"].GetValue(th));  
            Console.WriteLine("New value of ResultSetType:  {0}", th.Properties["ResultSetType"].GetValue(th), th.Properties["SqlStatementSourceType"].GetValue(th));  

            Console.WriteLine();  
        }  
    }  
}  
Imports System  
Imports System.Collections.Generic  
Imports System.Text  
Imports Microsoft.SqlServer.Dts.Runtime  
Imports Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask  

Namespace Microsoft.SqlServer.SSIS.Samples  
    Class Program  
        Shared  Sub Main(ByVal args() As String)  
            Dim pkg As Package =  New Package()   
            Dim exec1 As Executable =  pkg.Executables.Add("STOCK:SQLTask")   
            Dim th As TaskHost =  exec1 as TaskHost   

            ' List the default values of the Execute SQL task  
            ' using the Properties collection of the TaskHost.  
            Console.WriteLine("BypassPrepare          {0}", th.Properties("BypassPrepare").GetValue(th))  
            Console.WriteLine("CodePage               {0}", th.Properties("Connection").GetValue(th))  
            Console.WriteLine("Connection             {0}", th.Properties("Connection").GetValue(th))  
            Console.WriteLine("ExecutionValue         {0}", th.Properties("ExecutionValue").GetValue(th))  
            Console.WriteLine("IsStoredProcedure      {0}", th.Properties("IsStoredProcedure").GetValue(th))  
            Console.WriteLine("ParameterBindings      {0}", th.Properties("ParameterBindings").GetValue(th))  
            Console.WriteLine("ResultSetBindings      {0}", th.Properties("ResultSetBindings").GetValue(th))  
            Console.WriteLine("ResultSetType          {0}", th.Properties("ResultSetType").GetValue(th))  
            Console.WriteLine("SqlStatementSource     {0}", th.Properties("SqlStatementSource").GetValue(th))  
            Console.WriteLine("SqlStatementSourceType {0}", th.Properties("SqlStatementSourceType").GetValue(th))  
            Console.WriteLine("TimeOut                {0}", th.Properties("TimeOut").GetValue(th))  

            Console.WriteLine("--------------------------")  
            ' Show how to set a property using the TaskHost Properties.  
            Dim myVar As Variable =  pkg.Variables.Add("myVar",False,"User",100)   
            th.Properties("SqlStatementSourceType").SetValue(th, SqlStatementSourceType.Variable)  
            th.Properties("SqlStatementSource").SetValue(th, "myVar")  
            th.Properties("ResultSetType").SetValue(th, ResultSetType.ResultSetType_XML)  

            Console.WriteLine("New value of Source and SourceType:  {0}, {1}", th.Properties("SqlStatementSource").GetValue(th), th.Properties("SqlStatementSourceType").GetValue(th))  
            Console.WriteLine("New value of ResultSetType:  {0}", th.Properties("ResultSetType").GetValue(th), th.Properties("SqlStatementSourceType").GetValue(th))  

            Console.WriteLine()  
        End Sub  
    End Class  
End Namespace  

サンプル出力:

BypassPrepare False

CodePage

Connection

ExecutionValue

IsStoredProcedure False

ParameterBindings Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask.ParameterBindings

ResultSetBindings Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask.ResultBindings

ResultSetType 1

SqlStatementSource

SqlStatementSourceType 1

TimeOut 0

--------------------------

Source と SourceType の新しい値: myVar、3

ResultSetType の新しい値: 4

適用対象