共用方式為


ASExecuteDDLTask Class

Definition

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

public ref class ASExecuteDDLTask : Microsoft::DataTransformationServices::Tasks::DTSProcessingTask::ASTaskBase, Microsoft::SqlServer::Dts::Runtime::IDTSComponentPersist
[Microsoft.SqlServer.Dts.Runtime.DtsTask(IconResource="ExecuteTaskIcon", LocalizationType=typeof(Microsoft.DataTransformationServices.Tasks.DTSProcessingTask.ASExecuteDDLTask), UITypeName="Microsoft.DataTransformationServices.Tasks.DTSProcessingTaskUI.ASExecuteDDLTaskUI, Microsoft.SqlServer.ASTasksUI, Version=13.0.0.0, Culture=Neutral, PublicKeyToken=89845dcd8080cc91")]
[System.Runtime.InteropServices.Guid("B8A6644B-E7A4-4409-8B78-59572781BD15")]
public class ASExecuteDDLTask : Microsoft.DataTransformationServices.Tasks.DTSProcessingTask.ASTaskBase, Microsoft.SqlServer.Dts.Runtime.IDTSComponentPersist
[System.Runtime.InteropServices.Guid("B8A6644B-E7A4-4409-8B78-59572781BD15")]
[Microsoft.SqlServer.Dts.Runtime.DtsTask(IconResource="ExecuteTaskIcon", LocalizationType=typeof(Microsoft.DataTransformationServices.Tasks.DTSProcessingTask.ASExecuteDDLTask), UITypeName="Microsoft.DataTransformationServices.Tasks.DTSProcessingTaskUI.ASExecuteDDLTaskUI, Microsoft.SqlServer.ASTasksUI, Version=14.0.0.0, Culture=Neutral, PublicKeyToken=89845dcd8080cc91")]
public class ASExecuteDDLTask : Microsoft.DataTransformationServices.Tasks.DTSProcessingTask.ASTaskBase, Microsoft.SqlServer.Dts.Runtime.IDTSComponentPersist
[System.Runtime.InteropServices.Guid("B8A6644B-E7A4-4409-8B78-59572781BD15")]
[Microsoft.SqlServer.Dts.Runtime.DtsTask(IconResource="ExecuteTaskIcon", LocalizationType=typeof(Microsoft.DataTransformationServices.Tasks.DTSProcessingTask.ASExecuteDDLTask), UITypeName="Microsoft.DataTransformationServices.Tasks.DTSProcessingTaskUI.ASExecuteDDLTaskUI, Microsoft.SqlServer.ASTasksUI, Version=15.0.0.0, Culture=Neutral, PublicKeyToken=89845dcd8080cc91")]
public class ASExecuteDDLTask : Microsoft.DataTransformationServices.Tasks.DTSProcessingTask.ASTaskBase, Microsoft.SqlServer.Dts.Runtime.IDTSComponentPersist
[<Microsoft.SqlServer.Dts.Runtime.DtsTask(IconResource="ExecuteTaskIcon", LocalizationType=typeof(Microsoft.DataTransformationServices.Tasks.DTSProcessingTask.ASExecuteDDLTask), UITypeName="Microsoft.DataTransformationServices.Tasks.DTSProcessingTaskUI.ASExecuteDDLTaskUI, Microsoft.SqlServer.ASTasksUI, Version=13.0.0.0, Culture=Neutral, PublicKeyToken=89845dcd8080cc91")>]
[<System.Runtime.InteropServices.Guid("B8A6644B-E7A4-4409-8B78-59572781BD15")>]
type ASExecuteDDLTask = class
    inherit ASTaskBase
    interface IDTSComponentPersist
[<System.Runtime.InteropServices.Guid("B8A6644B-E7A4-4409-8B78-59572781BD15")>]
[<Microsoft.SqlServer.Dts.Runtime.DtsTask(IconResource="ExecuteTaskIcon", LocalizationType=typeof(Microsoft.DataTransformationServices.Tasks.DTSProcessingTask.ASExecuteDDLTask), UITypeName="Microsoft.DataTransformationServices.Tasks.DTSProcessingTaskUI.ASExecuteDDLTaskUI, Microsoft.SqlServer.ASTasksUI, Version=14.0.0.0, Culture=Neutral, PublicKeyToken=89845dcd8080cc91")>]
type ASExecuteDDLTask = class
    inherit ASTaskBase
    interface IDTSComponentPersist
[<System.Runtime.InteropServices.Guid("B8A6644B-E7A4-4409-8B78-59572781BD15")>]
[<Microsoft.SqlServer.Dts.Runtime.DtsTask(IconResource="ExecuteTaskIcon", LocalizationType=typeof(Microsoft.DataTransformationServices.Tasks.DTSProcessingTask.ASExecuteDDLTask), UITypeName="Microsoft.DataTransformationServices.Tasks.DTSProcessingTaskUI.ASExecuteDDLTaskUI, Microsoft.SqlServer.ASTasksUI, Version=15.0.0.0, Culture=Neutral, PublicKeyToken=89845dcd8080cc91")>]
type ASExecuteDDLTask = class
    inherit ASTaskBase
    interface IDTSComponentPersist
Public Class ASExecuteDDLTask
Inherits ASTaskBase
Implements IDTSComponentPersist
Inheritance
ASExecuteDDLTask
Attributes
Implements

Examples

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("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();  
    }  

  }  

}  
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("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;"  

    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=10.0.0.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  

Constructors

ASExecuteDDLTask()

Creates a new instance of the ASExecuteDDLTask class.

Fields

bExecutionCanceled

The execution is cancelled.

(Inherited from ASTaskBase)
bTraceError

The trace error.

(Inherited from ASTaskBase)
ddl

The data definition language.

(Inherited from ASTaskBase)
m_events

The events.

(Inherited from ASTaskBase)
server

The server.

(Inherited from ASTaskBase)

Properties

ConnectionName

Gets or sets the name of the connection for the analysis services task.

(Inherited from ASTaskBase)
ExecutionValue

Gets the result of the Analysis Services Execute DDL task.

ProgressEventName

Gets the name of the progress event for the analysis services task.

(Inherited from ASTaskBase)
Source

Gets or sets the name of the source that contains the DDL statement to be sent to the Analysis Services server.

SourceType

Gets or sets a value from the DDLSourceType enumeration indicating the source type that contains the DDL statements.

StatusEventName

Gets the status event name for the Analysis Services Execute DDL task.

SubComponentName

Gets the sub component name for the Analysis Services Execute DDL task.

TargetServerVersion (Inherited from Task)
TaskDescription

Gets a description of the Analysis Services Execute DDL task.

TaskDisplayName

Gets the unique name for the Analysis Services Execute DDL task.

Version

*** Member deprecated; see Remarks. ***   Returns the version of the task. This property is read-only.

(Inherited from Task)

Methods

CanUpdate(String)

*** Member deprecated; see Remarks. ***   A Boolean that indicates whether the new package XML can update the old package XML.

(Inherited from Task)
Equals(Object)

Determines whether two object instances are equal.

(Inherited from DtsObject)
Execute(Connections, VariableDispenser, IDTSComponentEvents, IDTSLogging, Object)

Executes the analysis services task.

(Inherited from ASTaskBase)
ExecuteCommand(String, Connections, IDTSComponentEvents, Object) (Inherited from ASTaskBase)
FireError(Int32, String, String, String)

Raises an event when an error occurs.

(Inherited from ASTaskBase)
FireError(String, String)

Raises an event when an error occurs.

(Inherited from ASTaskBase)
GetConnectionID(Connections, String)

Gets a String containing the ID of the connection.

(Inherited from Task)
GetConnectionName(Connections, String)

Gets a String containing the name of the connection.

(Inherited from Task)
GetHashCode()

Returns the hash code for this instance.

(Inherited from DtsObject)
InitializeTask(Connections, VariableDispenser, IDTSInfoEvents, IDTSLogging, EventInfos, LogEntryInfos, ObjectReferenceTracker)

Initializes the properties associated with the task. This method is called by the runtime and is not used in code.

(Inherited from Task)
InternalExecute(Connections, VariableDispenser, IDTSComponentEvents, IDTSLogging, Object)

Executes the DDL task internally.

InternalValidate(Connections, VariableDispenser, IDTSComponentEvents, IDTSLogging)

Validates the DDL task internally.

LoadFromXML(XmlElement, IDTSInfoEvents)

This method is not callable by your application code. To load a package saved as .xml, use the LoadPackage(String, IDTSEvents) method.

SaveToXML(XmlDocument, IDTSInfoEvents)

This method is not callable by your application code. To save a package as .xml, use the SaveToXml(String, Package, IDTSEvents) method.

StopExecution()

Stops the execution of the analysis service task.

(Inherited from ASTaskBase)
SubscribeToProgressEvent(SessionTrace)

Subscribes the task to progress event.

(Inherited from ASTaskBase)
UnsubscribeToProgressEvent(SessionTrace)

Unsubscribes the task from the progress event.

(Inherited from ASTaskBase)
Update(String)

*** Member deprecated; see Remarks. ***   This method updates the old package XML with the new package XML if CanUpdate(String) is set to true.

(Inherited from Task)
Validate(Connections, VariableDispenser, IDTSComponentEvents, IDTSLogging)

Validates the analysis service task.

(Inherited from ASTaskBase)
ValidateConnection(Connections)

Validates the task connection.

(Inherited from ASTaskBase)
ValidateDDL(VariableDispenser, Connections, Exception)

Verifies that the DDL task is properly configured.

WriteLog(IDTSLogging, String)

Writes a log for the task.

(Inherited from ASTaskBase)

Applies to