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 run a batch file from stored Procedure.

Author  Topic 

mkvenk
Starting Member

1 Post

Posted - 2003-06-06 : 01:12:19
I've got a requirement where i should be able to run a batch file from a store procedure. Can you give me a solution ..

Regards
Murali.

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2003-06-06 : 01:27:14
If you are running with sufficient previlidges you can call the XP_CmdShell procedure which will fire off a command line call (such as a batch file) and return the result. This won't be very good to you if the batch file is long running.

If you want to run kick of the batch file and quickly return to your stored proc execution, you might be best off creating an Sql Agent Job to run the batch file. Set it up with no schedule and use MSDB..sp_StartJob to run it.

Damian
Go to Top of Page
   

- Advertisement -