SQL Server Forums
Profile | Register | 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
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Posting Yak Master

210 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: http://msdn.microsoft.com/en-us/library/ms190693.aspx

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: http://msdn.microsoft.com/en-us/library/ms175046.aspx

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

Very Important crosS Applying yaK Herder

52325 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  
 New 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.08 seconds. Powered By: Snitz Forums 2000