you must be in the first Configure SQl server to allow you to make this operation so Run this script on your server (take it from this link)

[https://mostafaelmasry.wordpress.com/2012/01/20/ole-automation-procedures-to-delete-file-from-pc/]

then run this Script

DECLARE @Result int

declare @File_Location as nvarchar(300) = ‘F:\fff.txt’

DECLARE @FSO_Token int

EXEC @Result = sp_OACreate ‘Scripting.FileSystemObject’, @FSO_Token OUTPUT

EXEC @Result = sp_OAMethod @FSO_Token, ‘DeleteFile’, NULL, @File_Location

EXEC @Result = sp_OADestroy @FSO_Token

 

 

 

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.