Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

ResultSetType Enumeration

Defines the type of result set that the Execute SQL task can use.

Namespace:  Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask
Assembly:  Microsoft.SqlServer.SQLTask (in Microsoft.SqlServer.SQLTask.dll)

public enum ResultSetType

Member nameDescription
ResultSetType_NoneSpecifies that the SQL statement does not return a result set. For example, this result set is used for queries that add, change, or delete records in a table.
ResultSetType_RowsetSpecifies that the result set has multiple rows. For example, this result set is used for a SELECT statement that retrieves all the rows in a table.
ResultSetType_SingleRowSpecifies that the result set is a single row. For example, this result set is used for a stored procedure that returns a return code or a SELECT statement that returns a count or a sum.
ResultSetType_XMLSpecifies that an XML result set is used when the query returns a result set in an XML format. For example, this result set is used for a SELECT statement that includes a FOR XML clause.

The following example creates an ExecuteSQLTask, then shows the default settings of the properties. It then sets the value of some properties, including the ResultSetType which uses this enumeration, to show how to set property values.

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));
            // 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));


Sample Output:

BypassPrepare False




IsStoredProcedure False

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

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

ResultSetType 1


SqlStatementSourceType 1

TimeOut 0


New value of Source and SourceType: myVar, 3

New value of ResultSetType: 4

Community Additions

© 2015 Microsoft