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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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