Executing EXE from Sql Stored Procedure
Posted on 2003-03-05
I have written an EXE using Visual Basic that updates some things in a database. What I am eventually wanting it to have the EXE run on a set schedule. So I was wanting to have a job scheduled on the Sql server, using sp_add_job, etc.
Right now I am just trying to test the syntax to execute this EXE. What I have been trying is
EXEC master..xp_cmdshell 'C:\temp\adodbTst.exe'
When I run this executable from the dos prompt myself, it works just fine. But when I run it through Sql it doesn't ever finish, it just hangs there and never completes.
I have been issuing this command by using the Sql Server Query Analyzer, which I wasn't sure if this is the best way to issue T-Sql statements or not. When I first start the Query Analyzer I connect to the database using my Windows logon information, so I would think it would be using my windows permissions when I run the xp_cmdshell command, is that right?
Any ideas on why this is not working? Is there a way to debug the execution to see what is making it not complete? Any help would be great, thanks.