Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 delete XL file using xp_cmdshell in sqlserver
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Posting Yak Master

213 Posts

Posted - 10/06/2012 :  01:57:16  Show Profile  Reply with Quote

Dear team ,

we need to know the XP_CMDSHELL usage in sql server 2008 and

and how to delete XL file or other files from specified Location using xp_cmdsheel


Flowing Fount of Yak Knowledge

5155 Posts

Posted - 10/06/2012 :  07:51:01  Show Profile  Reply with Quote
By default xp_cmdshell is disabled. So if you have not already enabled it, you will need to do so. See here:

Once you have enabled it, the usage is pretty simple - exec xp_cmdshell 'del C:\temp\yourexcel.xlsx'.

One thing you want to be careful about is permissions and security. Read through the permissions section on this page:

Edited by - sunitabeck on 10/06/2012 07:51:26
Go to Top of Page

Very Important crosS Applying yaK Herder

52326 Posts

Posted - 10/06/2012 :  12:08:33  Show Profile  Reply with Quote
usually proxy accounts are used for executing xp_cmdshell scripts giving desired permissions to those accounts

SQL Server MVP

Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.16 seconds. Powered By: Snitz Forums 2000