Diyoda_ - 4 months ago 32
C# Question

# Run executable from SQL Server

I have been stuck on a research on running an external exe file. What I have so far found was it can be done using
this:

EXEC master..xp_cmdshell '"C:\New Folder\test.exe"'


And also this must not be directly called in a trigger because it has to wait until the execution is done to complete the trigger.

So the encouraged approach for this is to have a scheduled job to poll for the table and call the .exe file from there to without creating any performance issues. So far I have accepted it and working on it.

So, before trying on this I am working on each part that has to be learned before implementing.I am testing the above piece of code keeping the database as master.
I have tried several more.

EXEC master..xp_cmdshell '"C:\New Folder\r.rar"'

EXEC master..xp_cmdshell '"C:\New Folder\text.text"'


So, I am thinking of this xp_cmdshell as a normal command prompt. I was expecting to be visible the exe file opening and opening of the tet file and the rar file. But its not working.

I have given the above details to tell my approach, Please give me a feed back if you have a better approach in your earlier experiences. Thanks in advance.