I'm copying SSIS packages from one SQL server to another in a C# program via DTUTIL. The packages are in MSDB.
string dtutilCmd = "/c DTUTIL /SOURCESERVER " + sourceServer + " /SQL " + myPackage + " /DestServer " + destServer + " /COPY " + myPackage;
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";
startInfo.Arguments = dtutilCmd;
process.StartInfo = startInfo;
process.Start();
The variables in the dtutilCmd
string are all strings. The issue is when my users input the package name they can get the case wrong. They might write MYPACKAGE
so it gets deployed as MYPACKAGE
, even if it actually exists as MyPackage
on the source server, which I want to preserve.
So I want to somehow grab the package name, and feed it into the last part of my dtutilCmd
string.