Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

DDLSourceType Enumeration

This enumeration provides values that indicate where the DDL source is located.

Namespace:  Microsoft.DataTransformationServices.Tasks.DTSProcessingTask
Assembly:  Microsoft.SqlServer.ASTasks (in Microsoft.SqlServer.ASTasks.dll)
public enum DDLSourceType
Member nameDescription
DirectInputIndicates that the DDL source is contained in the Source property.
FileConnectionIndicates that the DDL source is contained in a FILE connection.
VariableIndicates that the DDL source is contained in a Variable.

The following code sample creates, configures, and executes a new ASExecuteDDLTask that loads the DDL statement to execute from a file connection. The sample uses the DDLSourceType enumeration.

using Microsoft.SqlServer.Dts.Runtime;
using Microsoft.DataTransformationServices.Tasks.DTSProcessingTask;

class Module1
{

  public static void Main()
  {

    Package pkg = new Package();

    ConnectionManager asCM;
    asCM = pkg.Connections.Add("MSOLAP100");
    asCM.Name = "Analysis Services Connection Manager";
    asCM.ConnectionString = "Data Source=<servername>;" +
      "Initial Catalog=Adventure Works DW;Provider=MSOLAP;" +
      "Integrated Security=SSPI;Impersonation Level=Impersonate;";

    ConnectionManager cmdCM;
    cmdCM = pkg.Connections.Add("FILE");
    cmdCM.Name = "Command Source Connection Manager";
    cmdCM.ConnectionString = "C:\\ddltest.txt";

    Executable exe = pkg.Executables.Add("Microsoft.DataTransformationServices.Tasks.DTSProcessingTask.ASExecuteDDLTask, " +
      "Microsoft.SqlServer.ASTasks, Version=10.0.0.0, " +
      "Culture=neutral, PublicKeyToken=89845dcd8080cc91");
    TaskHost thTask = (TaskHost) exe;
    {
      thTask.Properties("ConnectionName").SetValue(thTask, "Analysis Services Connection Manager");
      thTask.Properties("SourceType").SetValue(thTask, DDLSourceType.FileConnection);
      thTask.Properties("Source").SetValue(thTask, "Command Source Connection Manager");
    }

    DTSExecResult valResults = pkg.Validate(pkg.Connections, pkg.Variables, null, null);

    if (valResults==DTSExecResult.Success)
    {
      pkg.Execute();
    }

  }

}
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.