Solved

sql server delete file with script

Posted on 2010-09-03
2
343 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
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…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

820 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