Solved

sql server delete file with script

Posted on 2010-09-03
2
317 Views
Last Modified: 2012-05-10
Hi,

I am using sql server and with bcp i created a file how can i delete that file from sql server with script
please help

Thanks,

R8VI
0
Comment
Question by:R8VI
2 Comments
 
LVL 7

Accepted Solution

by:
kovilpattiBalu earned 500 total points
ID: 33596331
Hi,
ie: xp_cmdshell 'del c:\delete-me-file.txt'
0
 
LVL 58

Expert Comment

by:cyberkiwi
ID: 33596361
If you have xp_cmdshell enabled (most likely not), you can use

exec xp_cmdshell 'del C:\path\to\filename.ext'

If not you can try COM and Scripting.FileSystemObject

http://www.kodyaz.com/articles/delete-file-from-sql-server-xp-cmdshell-ole-automation-procedures.aspx

0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Slow Connectivity over ODBC 8 36
Run SQL Server Proc from Access 11 31
Sql Query 6 67
sql server query 6 9
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to shrink a transaction log file down to a reasonable size.

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question