How to delete a file using t-sql?
INTERVIEW PREPARATION IN 30 MINs – Read Following wires for a quick interview preparation.
- SQL Server DBA “Interview Questions And Answers”
- SQL Azure Interview Questions and Answers Part – 1
- SQL Azure Interview Questions and Answers Part – 2
- Powershell Interview Questions and Answers
xp_cmdshell ‘del c:\delete-me-file.txt’
But you can get following error here
Msg 15281, Level 16, State 1, Procedure xp_cmdshell, Line 1
SQL Server blocked access to procedure ‘sys.xp_cmdshell’ of component ‘xp_cmdshell’ because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of ‘xp_cmdshell’ by using sp_configure. For more information about enabling ‘xp_cmdshell’, see “Surface Area Configuration” in SQL Server Books Online.
Following is the method to correct this.
exec sp_configure ‘xp_cmdshell’, 1
— Configuration option ‘xp_cmdshell’ changed from 0 to 1. Run the RECONFIGURE statement to install.
Online SQL Server Classes @ http://tuitionaffordable.webstarts.com