1

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?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Rocco The Taco
  • 3,695
  • 13
  • 46
  • 79

1 Answers1

3

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.

Martin Smith
  • 438,706
  • 87
  • 741
  • 845