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
 Transact-SQL (2000)
 execute xp_cmdshell in a stored procedure

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-10-23 : 09:24:49
chris briosos writes "how can i execute a xp_cmdshell in a stored procude???

here's my sample stored procedure:

---------------
CREATE PROCEDURE test AS

execute xp_cmdshell '\\chris\files\dirw.bat'
---------------

i cannot run it in query analyzer and its error is:

---------------
Server: Msg 2812, Level 16, State 62, Line 3
Could not find stored procedure 'xp_cmdshell'.
---------------


but when i just run the script in query analyzer like this

---------------
use master
execute xp_cmdshell '\\chris\files\dirw.bat'
---------------

the script runned.

can you help me on this... thanks..."
   

- Advertisement -