Backup Database Script

USE master;
GO

DECLARE @databaseName VARCHAR(256),
		@path VARCHAR(256),
		@date VARCHAR(50),
		@disk VARCHAR(256);

SET @databaseName = 'Singapore';
SET @path = 'C:\Office\Database\backup\';

SELECT @date = CONVERT(VARCHAR(20), GETDATE(), 112);
SELECT @disk = @path + @databaseName + '_' + @date + '.bak';

BACKUP DATABASE @databaseName TO DISK = @disk
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s