Partager via


Classe ASExecuteDDLTask

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

Hiérarchie d'héritage

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

Espace de noms :  Microsoft.DataTransformationServices.Tasks.DTSProcessingTask
Assembly :  Microsoft.SqlServer.ASTasks (en Microsoft.SqlServer.ASTasks.dll)

Syntaxe

'Déclaration
<GuidAttribute("FC95DF06-8E20-4f90-BFD5-B48AFA59C158")> _
<DtsTaskAttribute(LocalizationType := GetType(ASExecuteDDLTask), UITypeName := "Microsoft.DataTransformationServices.Tasks.DTSProcessingTaskUI.ASExecuteDDLTaskUI, Microsoft.SqlServer.ASTasksUI, Version=10.0.0.0, Culture=Neutral, PublicKeyToken=89845dcd8080cc91",  _
    IconResource := "ExecuteTaskIcon")> _
Public Class ASExecuteDDLTask _
    Inherits ASTaskBase _
    Implements IDTSComponentPersist
'Utilisation
Dim instance As ASExecuteDDLTask
[GuidAttribute("FC95DF06-8E20-4f90-BFD5-B48AFA59C158")]
[DtsTaskAttribute(LocalizationType = typeof(ASExecuteDDLTask), UITypeName = "Microsoft.DataTransformationServices.Tasks.DTSProcessingTaskUI.ASExecuteDDLTaskUI, Microsoft.SqlServer.ASTasksUI, Version=10.0.0.0, Culture=Neutral, PublicKeyToken=89845dcd8080cc91", 
    IconResource = "ExecuteTaskIcon")]
public class ASExecuteDDLTask : ASTaskBase, 
    IDTSComponentPersist
[GuidAttribute(L"FC95DF06-8E20-4f90-BFD5-B48AFA59C158")]
[DtsTaskAttribute(LocalizationType = typeof(ASExecuteDDLTask), UITypeName = L"Microsoft.DataTransformationServices.Tasks.DTSProcessingTaskUI.ASExecuteDDLTaskUI, Microsoft.SqlServer.ASTasksUI, Version=10.0.0.0, Culture=Neutral, PublicKeyToken=89845dcd8080cc91", 
    IconResource = L"ExecuteTaskIcon")]
public ref class ASExecuteDDLTask : public ASTaskBase, 
    IDTSComponentPersist
[<GuidAttribute("FC95DF06-8E20-4f90-BFD5-B48AFA59C158")>]
[<DtsTaskAttribute(LocalizationType = typeof(ASExecuteDDLTask), UITypeName = "Microsoft.DataTransformationServices.Tasks.DTSProcessingTaskUI.ASExecuteDDLTaskUI, Microsoft.SqlServer.ASTasksUI, Version=10.0.0.0, Culture=Neutral, PublicKeyToken=89845dcd8080cc91", 
    IconResource = "ExecuteTaskIcon")>]
type ASExecuteDDLTask =  
    class
        inherit ASTaskBase
        interface IDTSComponentPersist
    end
public class ASExecuteDDLTask extends ASTaskBase implements IDTSComponentPersist

Le type ASExecuteDDLTask expose les membres suivants.

Constructeurs

  Nom Description
Méthode publique ASExecuteDDLTask Initializes a new instance of the ASExecuteDDLTask class.

Haut de la page

Propriétés

  Nom Description
Propriété publique ConnectionName Infrastructure. (hérité de ASTaskBase.)
Propriété publique ExecutionValue Returns the result of the task execution. (remplace Task. . :: . .ExecutionValue.)
Propriété protégée ProgressEventName Infrastructure. (hérité de ASTaskBase.)
Propriété publique Source Gets or sets the text of the DDL statement to be sent to the Analysis Services server.
Propriété publique SourceType Gets or sets a value from the DDLSourceType enumeration indicating the source type that contains the DDL statements.
Propriété protégée StatusEventName Infrastructure. (remplace ASTaskBase. . :: . .StatusEventName.)
Propriété protégée SubComponentName Infrastructure. (remplace ASTaskBase. . :: . .SubComponentName.)
Propriété publiqueMembre statique TaskDescription Returns a description of the Analysis Services Execute DDL task.
Propriété publiqueMembre statique TaskDisplayName Returns the name of the Execute DDL task.
Propriété publique Version *** Member deprecated; see Remarks. ***    Returns the version of the task. This property is read-only. (hérité de Task.)

Haut de la page

Méthodes

  Nom Description
Méthode publique CanUpdate *** Member deprecated; see Remarks. ***    A Boolean that indicates whether the new package XML can update the old package XML. (hérité de Task.)
Méthode publique Equals Determines whether two object instances are equal. (hérité de DtsObject.)
Méthode publique Execute Infrastructure. (hérité de ASTaskBase.)
Méthode protégée Finalize (hérité de Object.)
Méthode protégée FireError(String, String) Infrastructure. (hérité de ASTaskBase.)
Méthode protégée FireError(Int32, String, String, String) Infrastructure. (hérité de ASTaskBase.)
Méthode publique GetConnectionID Gets a String containing the ID of the connection. (hérité de Task.)
Méthode publique GetConnectionName Gets a String containing the name of the connection. (hérité de Task.)
Méthode publique GetHashCode Returns the hash code for this instance. (hérité de DtsObject.)
Méthode publique GetType (hérité de Object.)
Méthode publique InitializeTask Initializes the properties associated with the task. This method is called by the runtime and is not used in code. (hérité de Task.)
Méthode protégée InternalExecute Infrastructure. (remplace ASTaskBase. . :: . .InternalExecute(Connections, VariableDispenser, IDTSComponentEvents, IDTSLogging, Object).)
Méthode protégée InternalValidate Infrastructure. (remplace ASTaskBase. . :: . .InternalValidate(Connections, VariableDispenser, IDTSComponentEvents, IDTSLogging).)
Méthode publique LoadFromXML This method is not callable by your application code. To load a package saved as .xml, use the Application..::..LoadPackage method.
Méthode protégée MemberwiseClone (hérité de Object.)
Méthode publique SaveToXML This method is not callable by your application code. To save a package as .xml, use the Application..::..SaveToXml method.
Méthode protégée StopExecution Infrastructure. (hérité de ASTaskBase.)
Méthode protégée SubscribeToProgressEvent Infrastructure. (hérité de ASTaskBase.)
Méthode publique ToString (hérité de Object.)
Méthode protégée UnsubscribeToProgressEvent Infrastructure. (hérité de ASTaskBase.)
Méthode publique Update *** Member deprecated; see Remarks. ***    This method updates the old package XML with the new package XML if CanUpdate is set to true. (hérité de Task.)
Méthode publique Validate Infrastructure. (hérité de ASTaskBase.)
Méthode protégée ValidateConnection Infrastructure. (hérité de ASTaskBase.)
Méthode protégée ValidateDDL Infrastructure. (remplace ASTaskBase. . :: . .ValidateDDL(VariableDispenser, Connections, Exception%).)
Méthode protégée WriteLog Infrastructure. (hérité de ASTaskBase.)

Haut de la page

Champs

  Nom Description
Champ protégé bExecutionCanceled Infrastructure. (hérité de ASTaskBase.)
Champ protégé bTraceError Infrastructure. (hérité de ASTaskBase.)
Champ protégé ddl Infrastructure. (hérité de ASTaskBase.)
Champ protégé m_events Infrastructure. (hérité de ASTaskBase.)
Champ protégé server Infrastructure. (hérité de ASTaskBase.)

Haut de la page

Exemples

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

Sécurité des threads

Tous les membres publics static (Shared dans Visual Basic) de ce type sont thread-safe. Tous les membres de l'instance ne sont pas garantis comme étant thread-safe.