SQL Backup Scripts

I needed to setup a one-time backup for all databases on a SQL Server today, normally they are backed up with Veeam and I wanted to have native SQL backups.

I found that this query will built the backup commands for you.

DECLARE @path varchar(200)

SET @path =

‘BACKUP DATABASE ‘+name+‘ TO DISK = ”’+@path+name+‘.bak” WITH INIT, STATS = 5;’

You can they copy the results of the query to a new query and start the backup of all your databses at once.

Leave a Reply

Your email address will not be published. Required fields are marked *