Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 execute SSIS package with dtexec utility

Author  Topic 

sanghavi17389
Starting Member

26 Posts

Posted - 2013-01-17 : 08:12:04
Hi,

I have made web application and wcf service.
from web api, user can select csv file and in wcf service i want to do code for execute the package.

can anyone suggest me code for executing package using dtexec.exe in command line?

if I write "C:\Program Files\Microsoft SQL Server\100\DTS\Binn\dtexec.exe" /F "D:\CloudAmber\Icarus\CloudAmber.DataWarehouse\Harshal\testRecordCount\testRecordCount\Package.dtsx" in command prompt then it works.

but how to pass it to command prompt from c# code?


harshal sanghavi

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-01-17 : 08:50:38
Normally one should be able to use the Process class in the System.Diagnostics namespace. The Process.Start method is overloaded with a number of paramters - there is a decent tutorial here: http://www.dotnetperls.com/process-start However, I didn't quite understand your architecture, so if you are unable to invoke Process class on the host system this may not work for you.

There is also a Package class. What you want to look for are Microsoft.SqlServer.Dts.Runtime.Application.LoadPackage and Package.execute.
Go to Top of Page

sanghavi17389
Starting Member

26 Posts

Posted - 2013-01-17 : 09:03:57
I already tried with that.
I passed the command which I mentioned above in process.start but it does not work.
Let me know that is there any way by which I can execute above command in command prompt?
quote:
Originally posted by James K

Normally one should be able to use the Process class in the System.Diagnostics namespace. The Process.Start method is overloaded with a number of paramters - there is a decent tutorial here: http://www.dotnetperls.com/process-start However, I didn't quite understand your architecture, so if you are unable to invoke Process class on the host system this may not work for you.

There is also a Package class. What you want to look for are Microsoft.SqlServer.Dts.Runtime.Application.LoadPackage and Package.execute.



harshal sanghavi
Go to Top of Page

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-01-17 : 09:11:32
The other option that I can think of is what I had mentioned about the Package class. At the bare minimum, you would load the package using Application.LoadPackage and then run that package using the Execute method of the Package class.

http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.dts.runtime.application.loadpackage.aspx
http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.dts.runtime.package.execute.aspx

Are you able to do anything at all - even simple commands - using the Process.Start method, or is it that the dtexec is failing?
Go to Top of Page
   

- Advertisement -