Please start any new threads on our new site at http://forums.sqlteam.com. 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!
Username:
Password:
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  

kond.mohan
Posting Yak Master

India
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

Regards
K.Mohan

sunitabeck
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

visakh16
Very Important crosS Applying yaK Herder

India
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
http://visakhm.blogspot.com/

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