Vijay
asked on
T-SQL for Delete backups
How to write T-SQL to compare two existing sql backups (.bak) in a given location and delete old backups?
This is sql server 2016?
This is sql server 2016?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Why not set up a maintenance plan to "set and forget" once you are happy with it of course...
Read : https://docs.microsoft.com/en-us/sql/relational-databases/maintenance-plans/use-the-maintenance-plan-wizard
Or walkthrough : https://dataginger.com/2013/08/07/sql-server-automating-backup-files-cleanup-task-using-maintenance-plans/
Includes disk cleanup...
Read : https://docs.microsoft.com/en-us/sql/relational-databases/maintenance-plans/use-the-maintenance-plan-wizard
Or walkthrough : https://dataginger.com/2013/08/07/sql-server-automating-backup-files-cleanup-task-using-maintenance-plans/
Includes disk cleanup...
ASKER
Mark Yes. We already configured maintenance plans . But this requirement is for some testing.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What do you want to compare?
If they are the same backup file? Then check the file names, sizes and date and time.
If they are the same backup file? Then check the file names, sizes and date and time.
Vijay, please let us know if this issue has been solved or if you need further help.
ASKER
Thank you very much Virot
ASKER
Thank you Vitor.
ASKER
Let me try and get back to you.