• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 659
  • Last Modified:

sql server delete file with script

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
R8VI
Asked:
R8VI
1 Solution
 
kovilpattiBaluCommented:
Hi,
ie: xp_cmdshell 'del c:\delete-me-file.txt'
0
 
cyberkiwiCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now