16 Sept 2011

SQL Database Backup Query

DECLARE @PATH VARCHAR(max)
SET @PATH = 'C:\CGLHRIS BACKUP\CGLHRIS_' + CONVERT(VARCHAR(16), GETDATE(), 112) + replace(CONVERT(VARCHAR(8), GETDATE(), 108),':','') + '.bak'
BACKUP DATABASE [DatabaseName] TO DISK = @PATH WITH FORMAT

No comments:

Post a Comment