启动:
exec master..xp_cmdshell 'net start "Distributed Transaction Coordinator"'停止:exec master..xp_cmdshell 'net stop "Distributed Transaction Coordinator"'

解决方案 »

  1.   

    Function ExecDTS(strDTS_Name: string): boolean;
    var
      n: Variant;
      oConnection: Variant;
      oStep,oTask,oCustomTask: variant;
    begin
      moPackage := CreateOleObject('dts.package2');
      oConnection := moPackage.Connections.New('SQLOLEDB');
      oStep := moPackage.Steps.New;
      oTask := moPackage.Tasks.New('DTSExecutePackageTask');
      oCustomTask := oTask.CustomTask;
      moPackage.FailOnError := True;  oCustomTask.PackagePassword := 'user';
      oCustomTask.FileName := strDTS_Name;
      oCustomTask.Name := 'ExecPkgTask';  oStep.TaskName := oCustomTask.Name;
      oStep.Name := 'ExecPkgStep';
      oStep.ExecuteInMainThread := True;  moPackage.Steps.Add(oStep);
      moPackage.Tasks.Add(oTask);
      try
        moPackage.Execute;
      except
        oCustomTask := n;
        oTask := n;
        oStep := n;
        moPackage.Uninitialize;
        ExecDTS := False;
        Exit;
      end;  ExecDTS := True;
      oCustomTask := n;
      oTask := n;
      oStep := n;
      moPackage.Uninitialize;
    end;
      

  2.   

    SQL语句:--启动:
    exec master..xp_cmdshell 'net start "Distributed Transaction Coordinator"'--停止:
    exec master..xp_cmdshell 'net stop "Distributed Transaction Coordinator"'