Skip to content

Instantly share code, notes, and snippets.

@mattanja
Created September 13, 2015 00:08
Show Gist options
  • Save mattanja/462e7285267186abc33b to your computer and use it in GitHub Desktop.
Save mattanja/462e7285267186abc33b to your computer and use it in GitHub Desktop.
DECLARE @datestring [nvarchar](10) = CONVERT(nvarchar, GETDATE(), 126);
DECLARE @filepath [nvarchar](max) = N'C:\Data\BackupDatabase\' + @datestring + N'-DBNAME.bak';
SELECT @filepath;
BACKUP DATABASE [DBNAME]
TO DISK = @filepath
WITH NOFORMAT, INIT, NAME = N'DBNAME-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10
GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment