Skip to content

Instantly share code, notes, and snippets.

@mattanja
Created September 13, 2015 00:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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