See this link for deleting files. It is using xp_cmdshell which needs to be on in your instance plus proper security for the account running your service.
To delete on a different server, use '//servname/sharename/path'
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
On SQL Server 11 Std version, I have two tables TableA and TableB in a database db1. TableA have columns called CreatedOn, Status and Path. Path column stores location where a file is stored on a file server outside SQL Server. TableA and TableB has one to many relationship. Also when a row is deleted from TableA, related rows from TableB are also deleted.
Now I want to run a query everyday at 11PM that will delete all the records from TableA with a Status of Pending from TableA. Also I want to delete files stored on file server related to deleted records if Path column is not empty.
Note that file server and SQL servers are two different servers.
Is this possible and if so can someone give me a clue as how to accomplish this.
See this link for deleting files. It is using xp_cmdshell which needs to be on in your instance plus proper security for the account running your service.
To delete on a different server, use '//servname/sharename/path'