Compartir a través de


ASExecuteDDLTask Class

Executes Data Definition Language (DDL) commands against an instance of SQL Server 2005 Analysis Services (SSAS).

Espacio de nombres: Microsoft.DataTransformationServices.Tasks.DTSProcessingTask
Ensamblado: Microsoft.SqlServer.ASTasks (in microsoft.sqlserver.astasks.dll)

Sintaxis

'Declaración
<DtsTaskAttribute(LocalizationType:=GetType(ASExecuteDDLTask), UITypeName:="Microsoft.DataTransformationServices.Tasks.DTSProcessingTaskUI.ASExecuteDDLTaskUI, Microsoft.SqlServer.ASTasksUI, Version=9.00.242.00, Culture=Neutral, PublicKeyToken=89845dcd8080cc91", IconResource:="ExecuteTaskIcon")> _
<GuidAttribute("070EF51B-33EC-4b4c-983C-59DBB8E2BB23")> _
Public Class ASExecuteDDLTask
    Inherits ASTaskBase
    Implements IDTSComponentPersist
[DtsTaskAttribute(LocalizationType=typeof(ASExecuteDDLTask), UITypeName="Microsoft.DataTransformationServices.Tasks.DTSProcessingTaskUI.ASExecuteDDLTaskUI, Microsoft.SqlServer.ASTasksUI, Version=9.00.242.00, Culture=Neutral, PublicKeyToken=89845dcd8080cc91", IconResource="ExecuteTaskIcon")] 
[GuidAttribute("070EF51B-33EC-4b4c-983C-59DBB8E2BB23")] 
public class ASExecuteDDLTask : ASTaskBase, IDTSComponentPersist
[DtsTaskAttribute(LocalizationType=typeof(ASExecuteDDLTask), UITypeName=L"Microsoft.DataTransformationServices.Tasks.DTSProcessingTaskUI.ASExecuteDDLTaskUI, Microsoft.SqlServer.ASTasksUI, Version=9.00.242.00, Culture=Neutral, PublicKeyToken=89845dcd8080cc91", IconResource=L"ExecuteTaskIcon")] 
[GuidAttribute(L"070EF51B-33EC-4b4c-983C-59DBB8E2BB23")] 
public ref class ASExecuteDDLTask : public ASTaskBase, IDTSComponentPersist
/** @attribute DtsTaskAttribute(LocalizationType=Microsoft.DataTransformationServices.Tasks.DTSProcessingTask.ASExecuteDDLTask, UITypeName="Microsoft.DataTransformationServices.Tasks.DTSProcessingTaskUI.ASExecuteDDLTaskUI, Microsoft.SqlServer.ASTasksUI, Version=9.00.242.00, Culture=Neutral, PublicKeyToken=89845dcd8080cc91", IconResource="ExecuteTaskIcon") */ 
/** @attribute GuidAttribute("070EF51B-33EC-4b4c-983C-59DBB8E2BB23") */ 
public class ASExecuteDDLTask extends ASTaskBase implements IDTSComponentPersist
DtsTaskAttribute(LocalizationType=Microsoft.DataTransformationServices.Tasks.DTSProcessingTask.ASExecuteDDLTask, UITypeName="Microsoft.DataTransformationServices.Tasks.DTSProcessingTaskUI.ASExecuteDDLTaskUI, Microsoft.SqlServer.ASTasksUI, Version=9.00.242.00, Culture=Neutral, PublicKeyToken=89845dcd8080cc91", IconResource="ExecuteTaskIcon") 
GuidAttribute("070EF51B-33EC-4b4c-983C-59DBB8E2BB23") 
public class ASExecuteDDLTask extends ASTaskBase implements IDTSComponentPersist

Inheritance Hierarchy

System.Object
   Microsoft.SqlServer.Dts.Runtime.DtsObject
     Microsoft.SqlServer.Dts.Runtime.Task
       Microsoft.DataTransformationServices.Tasks.DTSProcessingTask.ASTaskBase
        Microsoft.DataTransformationServices.Tasks.DTSProcessingTask.ASExecuteDDLTask

Ejemplo

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

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("MSOLAP90");
    asCM.Name = "Analysis Services Connection Manager";
    asCM.ConnectionString = "Data Source=<servername>;" +
      "Initial Catalog=Adventure Works DW;Provider=MSOLAP.3;" +
      "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=9.0.242.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();
    }

  }

}
Imports Microsoft.SqlServer.Dts.Runtime
Imports Microsoft.DataTransformationServices.Tasks.DTSProcessingTask

Module Module1

  Sub Main()

    Dim pkg As New Package

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

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

    Dim exe As Executable = pkg.Executables.Add( _
      "Microsoft.DataTransformationServices.Tasks.DTSProcessingTask.ASExecuteDDLTask, " & _
      "Microsoft.SqlServer.ASTasks, Version=9.0.242.0, " & _
      "Culture=neutral, PublicKeyToken=89845dcd8080cc91")
    Dim thTask As TaskHost = CType(exe, TaskHost)
    With thTask
      .Properties("ConnectionName").SetValue(thTask, _
        "Analysis Services Connection Manager")
      .Properties("SourceType").SetValue(thTask, DDLSourceType.FileConnection)
      .Properties("Source").SetValue(thTask, "Command Source Connection Manager")
    End With

    Dim valResults As DTSExecResult = pkg.Validate( _
      pkg.Connections, pkg.Variables, Nothing, Nothing)

    If valResults = DTSExecResult.Success Then
      pkg.Execute()
    End If

  End Sub

End Module

Seguridad para subprocesos

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Plataformas

Plataformas de desarrollo

Para obtener una lista de las plataformas compatibles, vea Requisitos de hardware y software para instalar SQL Server 2005.

Plataformas de destino

Para obtener una lista de las plataformas compatibles, vea Requisitos de hardware y software para instalar SQL Server 2005.

Vea también

Referencia

ASExecuteDDLTask Members
Microsoft.DataTransformationServices.Tasks.DTSProcessingTask Namespace