Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

SQL Backup to weekday folder?

$
0
0

Hi All-

My and my co-worker (neither of us know SQL very well other than Admin tasks) are trying to setup SQL backups to go into a specific folder depending on the day of the week.

For production servers we currently use a software called "RedGate" which all you need to do is replace the folder of the day with "".

However, we use the SQL agent to backup non-prod servers. This is the script we are currently using:

Text
-- Name of database DECLARE @DatabaseName VARCHAR(50) -- Path of backup folder. DECLARE @BackupPath VARCHAR(256) -- Name of Backup file DECLARE @BackUpFileName VARCHAR(256) -- Get current date used for suffixing with file name. DECLARE @Date VARCHAR(20) -- Specify path for database backup directory. Make sure directory exists before executing script, else script will give error. SET @BackupPath = "\\nas\backup\Week1\\...

Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>