What I want to do is run a SSIS Package using this command line:
/SQL "\"\[PACKAGE_NAME]\"" /SERVER [SERVER NAME] /X86 /CHECKPOINTING OFF /REPORTING E
This is my code until now:
using System;
using System.Data;
using Microsoft.SqlServer.Dts.Runtime;
using System.Windows.Forms;
using System.Collections.Generic;
using System.Data.OleDb;
using System.Threading;
using System.Diagnostics;
namespace blablabla.csproj
{
[Microsoft.SqlServer.Dts.Tasks.ScriptTask.SSISScriptTaskEntryPointAttribute]
public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
{
#region VSTA generated code
enum ScriptResults
{
Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success,
Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure
};
#endregion
public void Main()
{
// Variables
string targetServerName = Dts.Variables["SSIS_SERVER"].Value.ToString();
string packageExecutionName = "package_folder" + "\"" + "package_name";
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.UseShellExecute = false;
startInfo.RedirectStandardOutput = true;
startInfo.CreateNoWindow = true;
startInfo.FileName = @"dtexec.exe";
string arguments = @"/SQL " + "\"" + "\\" + packageExecutionName + "\"" + " / SERVER " + Dts.Variables["SSIS_SERVER"].Value.ToString() + " / X86 / CHECKPOINTING OFF / REPORTING E /CONSOLELOG M";
Dts.Variables["SSIS_SERVER"].Value.ToString();
// arguments to dtexec
startInfo.Arguments = arguments;
// begin execution
Process proc = Process.Start(startInfo);
}
}
}
The script task runs with success but the package itself doesn't run, so the code must be wrong...
This is my very first time coding in C#, so apologies for any "trivial" error. I've searched on the internet but almost all of the cases it's using the specific folder where the package is saved and then run the package there, but what I need is running with this specific command line.
Thanks for your time.