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
 SQL Server Development (2000)
 how to execute a EXE from a stored procedure.

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-05-13 : 01:48:04
Anees writes "I want to call a .EXE file from stored procedure is it possible to do it? if yes then please send me some examples...
thanks in advance."

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2002-05-13 : 01:57:16
Hi

You can use the extended stored procedure xp_cmdshell to run external programs. I.E. Exec xp_CmdShell 'C:\myprogram.exe'



Damian
Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2002-05-13 : 09:40:32
FYI....
I haev used this before, and if your EXE does not terminate, or doesn't terminate normally, your proc will "keep running" until the EXE dies. It locked me out of an entire DB until I used task manager to kill the EXE once when my EXE had an error.

From BOL:
xp_cmdshell operates synchronously. Control is not returned until the command shell command completes.

Michael



Go to Top of Page
   

- Advertisement -