次の方法で共有


ProcessingCommands プロパティ

Analysis Services サーバーに送信される処理コマンドのテキストを取得します。値の設定も可能です。

名前空間:  Microsoft.DataTransformationServices.Tasks.DTSProcessingTask
アセンブリ:  Microsoft.SqlServer.ASTasks (Microsoft.SqlServer.ASTasks.dll)

構文

'宣言
Public Property ProcessingCommands As String
    Get
    Set
'使用
Dim instance As DTSProcessingTask
Dim value As String

value = instance.ProcessingCommands

instance.ProcessingCommands = value
public string ProcessingCommands { get; set; }
public:
property String^ ProcessingCommands {
    String^ get ();
    void set (String^ value);
}
member ProcessingCommands : string with get, set
function get ProcessingCommands () : String
function set ProcessingCommands (value : String)

プロパティ値

型: System. . :: . .String
Analysis Services サーバーに送信される処理コマンドのテキストです。

説明

処理コマンドは、XMLA コマンドの Batch および Process を含む XML for Analysis (XMLA) ステートメントで構成されています。形式は次の例のとおりです。

<Batch xmlns="https://schemas.microsoft.com/analysisservices/2003/engine">

<Process xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<Object>

<DatabaseID>Adventure Works DW</DatabaseID>

<DimensionID>Dim Customer</DimensionID>

</Object>

<Type>ProcessUpdate</Type>

<WriteBackTableCreation>UseExisting</WriteBackTableCreation>

</Process>

</Batch>

使用例

次のコード サンプルでは、Adventure Works DW サンプル データベースの Targeted Mailing マイニング モデルを処理する新しい DTSProcessingTask を作成し、構成して、実行します。このサンプルでは、ProcessingCommands プロパティを使用しています。

using Microsoft.SqlServer.Dts.Runtime;
using System.Reflection;

class Module1
{

  public static void Main()
  {

    Package pkg = new Package();
    string procCmd;

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

    procCmd = "<Batch xmlns=\"https://schemas.microsoft.com/analysisservices/2003/engine\">" +
      "<Parallel>" +
        "<Process xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " +
            "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" +
          "<Object>" +
            "<DatabaseID>Adventure Works DW</DatabaseID>" +
            "<MiningStructureID>Targeted Mailing</MiningStructureID>" +
          "</Object>" +
          "<Type>ProcessFull</Type>" +
          "<WriteBackTableCreation>UseExisting</WriteBackTableCreation>" +
        "</Process>" +
      "</Parallel>" +
    "</Batch>";

    Executable exe = pkg.Executables.Add("Microsoft.DataTransformationServices.Tasks.DTSProcessingTask.DTSProcessingTask, " +
      "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("ProcessingCommands").SetValue(thTask, procCmd);
    }

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

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

  }

}
Imports Microsoft.SqlServer.Dts.Runtime
Imports System.Reflection

Module Module1

  Sub Main()

    Dim pkg As New Package
    Dim procCmd As String

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

    procCmd = "<Batch https://schemas.microsoft.com/analysisservices/2003/engine"">" & _
      "<Parallel>" & _
        "<Process xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" " & _
            "xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"">" & _
          "<Object>" & _
            "<DatabaseID>Adventure Works DW</DatabaseID>" & _
            "<MiningStructureID>Targeted Mailing</MiningStructureID>" & _
          "</Object>" & _
          "<Type>ProcessFull</Type>" & _
          "<WriteBackTableCreation>UseExisting</WriteBackTableCreation>" & _
        "</Process>" & _
      "</Parallel>" & _
    "</Batch>"

    Dim exe As Executable = pkg.Executables.Add( _
      "Microsoft.DataTransformationServices.Tasks.DTSProcessingTask.DTSProcessingTask, " & _
      "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("ProcessingCommands").SetValue(thTask, procCmd)
    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