How execute exe file from sql agent or job?

大城市里の小女人 提交于 2019-11-29 17:15:58

问题


I don't want to hit the database frequently based on page request, so I planned to create a xml file using separate C# coding [exe file] & put in the common path to access from different page/project, which will do the hitting stuff's daily morning, so can you explain how do I execute exe file from sql job or agent by scheduled manner?

My scenario: database table will be updated only once, so I am going for a XML/txt file.

Thanks, S.Venkatesh


回答1:


Executable and batch files may be added to a job as step (MSDN Implement Jobs).

  1. Create a job
  2. Add a new step

    2.1 set "Operating system(CmdExec)" as type

    2.2 set the executable path




回答2:


If you must do it in JOB: xp_cmdshell xp_cmdshell execute as nonadmin!

DECLARE @command varchar(8000)
SET @command = 'C:\MyProgram' 
EXEC master..xp_cmdshell @command

But you should shedule task in windows.



来源:https://stackoverflow.com/questions/11754001/how-execute-exe-file-from-sql-agent-or-job

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!