共用方式為


ASExecuteDDLTask 類別

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

繼承階層

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

命名空間:  Microsoft.DataTransformationServices.Tasks.DTSProcessingTask
組件:  Microsoft.SqlServer.ASTasks (在 Microsoft.SqlServer.ASTasks.dll 中)

語法

'宣告
<GuidAttribute("FCA58F9B-5937-4FCF-B851-8683F7B5A98F")> _
<DtsTaskAttribute(LocalizationType := GetType(ASExecuteDDLTask), UITypeName := "Microsoft.DataTransformationServices.Tasks.DTSProcessingTaskUI.ASExecuteDDLTaskUI, Microsoft.SqlServer.ASTasksUI, Version=11.0.0.0, Culture=Neutral, PublicKeyToken=89845dcd8080cc91",  _
    IconResource := "ExecuteTaskIcon")> _
Public Class ASExecuteDDLTask _
    Inherits ASTaskBase _
    Implements IDTSComponentPersist
'用途
Dim instance As ASExecuteDDLTask
[GuidAttribute("FCA58F9B-5937-4FCF-B851-8683F7B5A98F")]
[DtsTaskAttribute(LocalizationType = typeof(ASExecuteDDLTask), UITypeName = "Microsoft.DataTransformationServices.Tasks.DTSProcessingTaskUI.ASExecuteDDLTaskUI, Microsoft.SqlServer.ASTasksUI, Version=11.0.0.0, Culture=Neutral, PublicKeyToken=89845dcd8080cc91", 
    IconResource = "ExecuteTaskIcon")]
public class ASExecuteDDLTask : ASTaskBase, 
    IDTSComponentPersist
[GuidAttribute(L"FCA58F9B-5937-4FCF-B851-8683F7B5A98F")]
[DtsTaskAttribute(LocalizationType = typeof(ASExecuteDDLTask), UITypeName = L"Microsoft.DataTransformationServices.Tasks.DTSProcessingTaskUI.ASExecuteDDLTaskUI, Microsoft.SqlServer.ASTasksUI, Version=11.0.0.0, Culture=Neutral, PublicKeyToken=89845dcd8080cc91", 
    IconResource = L"ExecuteTaskIcon")]
public ref class ASExecuteDDLTask : public ASTaskBase, 
    IDTSComponentPersist
[<GuidAttribute("FCA58F9B-5937-4FCF-B851-8683F7B5A98F")>]
[<DtsTaskAttribute(LocalizationType = typeof(ASExecuteDDLTask), UITypeName = "Microsoft.DataTransformationServices.Tasks.DTSProcessingTaskUI.ASExecuteDDLTaskUI, Microsoft.SqlServer.ASTasksUI, Version=11.0.0.0, Culture=Neutral, PublicKeyToken=89845dcd8080cc91", 
    IconResource = "ExecuteTaskIcon")>]
type ASExecuteDDLTask =  
    class 
        inherit ASTaskBase 
        interface IDTSComponentPersist 
    end
public class ASExecuteDDLTask extends ASTaskBase implements IDTSComponentPersist

ASExecuteDDLTask 型別公開下列成員。

建構函式

  名稱 說明
公用方法 ASExecuteDDLTask Creates a new instance of the ASExecuteDDLTask class.

上層

屬性

  名稱 說明
公用屬性 ConnectionName 基礎結構。Gets or sets the name of the connection for the analysis services task. (繼承自 ASTaskBase。)
公用屬性 ExecutionValue Gets the result of the Analysis Services Execute DDL task. (覆寫 Task.ExecutionValue。)
受保護的屬性 ProgressEventName 基礎結構。Gets the name of the progress event for the analysis services task. (繼承自 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. (覆寫 ASTaskBase.StatusEventName。)
受保護的屬性 SubComponentName 基礎結構。Gets the sub component name for the Analysis Services Execute DDL task. (覆寫 ASTaskBase.SubComponentName。)
公用屬性靜態成員 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. (繼承自 Task。)

上層

方法

  名稱 說明
公用方法 CanUpdate *** Member deprecated; see Remarks. ***    A Boolean that indicates whether the new package XML can update the old package XML. (繼承自 Task。)
公用方法 Equals Determines whether two object instances are equal. (繼承自 DtsObject。)
公用方法 Execute 基礎結構。Executes the analysis services task. (繼承自 ASTaskBase。)
受保護的方法 Finalize (繼承自 Object。)
受保護的方法 FireError(String, String) 基礎結構。Raises an event when an error occurs. (繼承自 ASTaskBase。)
受保護的方法 FireError(Int32, String, String, String) 基礎結構。Raises an event when an error occurs. (繼承自 ASTaskBase。)
公用方法 GetConnectionID Gets a String containing the ID of the connection. (繼承自 Task。)
公用方法 GetConnectionName Gets a String containing the name of the connection. (繼承自 Task。)
公用方法 GetHashCode Returns the hash code for this instance. (繼承自 DtsObject。)
公用方法 GetType (繼承自 Object。)
公用方法 InitializeTask Initializes the properties associated with the task. This method is called by the runtime and is not used in code. (繼承自 Task。)
受保護的方法 InternalExecute 基礎結構。Executes the DDL task internally. (覆寫 ASTaskBase.InternalExecute(Connections, VariableDispenser, IDTSComponentEvents, IDTSLogging, Object)。)
受保護的方法 InternalValidate 基礎結構。Validates the DDL task internally. (覆寫 ASTaskBase.InternalValidate(Connections, VariableDispenser, IDTSComponentEvents, IDTSLogging)。)
公用方法 LoadFromXML This method is not callable by your application code. To load a package saved as .xml, use the Application.LoadPackage method.
受保護的方法 MemberwiseClone (繼承自 Object。)
公用方法 SaveToXML This method is not callable by your application code. To save a package as .xml, use the Application.SaveToXml method.
受保護的方法 StopExecution 基礎結構。Stops the execution of the analysis service task. (繼承自 ASTaskBase。)
受保護的方法 SubscribeToProgressEvent 基礎結構。Subscribes the task to progress event. (繼承自 ASTaskBase。)
公用方法 ToString (繼承自 Object。)
受保護的方法 UnsubscribeToProgressEvent 基礎結構。Unsubscribes the task from the progress event. (繼承自 ASTaskBase。)
公用方法 Update *** Member deprecated; see Remarks. ***    This method updates the old package XML with the new package XML if CanUpdate is set to true. (繼承自 Task。)
公用方法 Validate 基礎結構。Validates the analysis service task. (繼承自 ASTaskBase。)
受保護的方法 ValidateConnection 基礎結構。Validates the task connection. (繼承自 ASTaskBase。)
受保護的方法 ValidateDDL 基礎結構。Verifies that the DDL task is properly configured. (覆寫 ASTaskBase.ValidateDDL(VariableDispenser, Connections, Exception%)。)
受保護的方法 WriteLog 基礎結構。Writes a log for the task. (繼承自 ASTaskBase。)

上層

欄位

  名稱 說明
受保護的欄位 bExecutionCanceled 基礎結構。The execution is cancelled. (繼承自 ASTaskBase。)
受保護的欄位 bTraceError 基礎結構。The trace error. (繼承自 ASTaskBase。)
受保護的欄位 ddl 基礎結構。The data definition language. (繼承自 ASTaskBase。)
受保護的欄位 m_events 基礎結構。The events. (繼承自 ASTaskBase。)
受保護的欄位 server 基礎結構。The server. (繼承自 ASTaskBase。)

上層

範例

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

執行緒安全性

這個型別的任何公用 static (在 Visual Basic 中為 Shared) 成員都是執行緒安全的。並不是所有的執行個體成員都保證可以用於所有的執行緒。

請參閱

參考

Microsoft.DataTransformationServices.Tasks.DTSProcessingTask 命名空間