Solved

sql server delete file with script

Posted on 2010-09-03
2
274 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
Comment Utility
Hi,
ie: xp_cmdshell 'del c:\delete-me-file.txt'
0
 
LVL 58

Expert Comment

by:cyberkiwi
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In this article I will describe the Backup & Restore 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.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

771 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now