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)
 batch File and Stored Procedures

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-09-23 : 08:09:31
Shanaz writes "How do I run an already created batch file using a Transact SQL stored procedure using SQL 2000"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2003-09-23 : 08:11:35
Use the xp_cmdshell extended procedure to run command-line utilities. Books Online has the full syntax, something like:

EXECUTE master..xp_cmdshell 'dir c:\'

or

EXECUTE master..xp_cmdshell 'c:\myBatchFile.bat'

Note that you cannot run a program that requires user intervention, it will simply sit and wait forever.
Go to Top of Page
   

- Advertisement -