SQL Server 2000 xp_cmdshell

5.7k views Asked by At

Using SQL Server 2000 I am trying to use this command in Query Analyzer

xp_cmdshell 'del c:\delete-me-file.txt'

and I'm getting this error:

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

Basically I want to delete this file from the system... what command do I need to run to do this?

1

There are 1 answers

0
Martin Smith On BEST ANSWER

You need to be in the context of the master database or prefix the extended stored procedure with the db name.

EXEC master..xp_cmdshell 'del c:\delete-me-file.txt' 

If this command succeeds it would indicate that the SQL Server service account probably has too many permissions however.