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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Execute exe from sql job.

Author  Topic 

srahulmca
Starting Member

4 Posts

Posted - 2010-05-20 : 00:56:49
Hi All

I have written an exe that will generate an excel report. I want to run this exe from sql server 2000. I scheduled a job for this. In the step for type i have specified as CmdExec and in the command i gave C:\psaudit\tool.exe and process exit code as 0.

When i run the job it say successful but i think its not running the exe because the excel file is not generated. But when i double click the exe the excel file is getting generated.


I will be very thanksfull to you if someone could help in resolving this problem.



Thanks
Rahul

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2010-05-20 : 03:57:48
the most likely reason is that the user your sql agent is running under doesn't have permissions to write in the destination folder.

___________________________________________________________________________
Causing trouble since 1980
Blog: http://weblogs.sqlteam.com/mladenp
Speed up SSMS development: www.ssmstoolspack.com <- version 1.7 out!
Go to Top of Page

srahulmca
Starting Member

4 Posts

Posted - 2010-05-20 : 08:16:08
I have resolved this issue. I gave the command \psaudit\tool.exe. instead of c:\psaudit\tool.exe

WHen i removed c: it worked.

Thanks a lot for all those who helped me.

Thanks
Rahul
Go to Top of Page

srahulmca
Starting Member

4 Posts

Posted - 2010-05-21 : 01:28:37
I observed that what was mentioned by me previously was wrong. The issue lies with exe file.

When i execute the exe it picks the current path from where the exe runs and creates a xls file in the same location. The above mentioned job worked when I harded the path where the xls file needs to be generated.


When sql server runs the exe it runs the application from C:\WINDOWS\system32 instead of running the application from current location C:\psaudit\ and what happens in the xls is getting generated in C:\WINDOWS\system32 instead of getting generated from C:\psaudit
Thanks
Rahul
Go to Top of Page
   

- Advertisement -