启动:
exec master..xp_cmdshell 'net start "Distributed Transaction Coordinator"'停止:exec master..xp_cmdshell 'net stop "Distributed Transaction Coordinator"'
exec master..xp_cmdshell 'net start "Distributed Transaction Coordinator"'停止:exec master..xp_cmdshell 'net stop "Distributed Transaction Coordinator"'
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;
exec master..xp_cmdshell 'net start "Distributed Transaction Coordinator"'--停止:
exec master..xp_cmdshell 'net stop "Distributed Transaction Coordinator"'