Link to home
Create AccountLog in
Avatar of R8VI
R8VI

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of kovilpattiBalu
kovilpattiBalu
Flag of India image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of cyberkiwi
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