Thursday, August 10, 2017

SQL Query to create backup of single database

Here i am discussing about backup of database to specific folder of your computer drive using SQL Query.

Simply we have writing below query for backup of database:

Syntax :

USE database_name;
GO

BACKUP DATABASE database_name
TO DISK = 'path_of_folder_in_your_system_drive\database_name.Bak'
WITH FORMAT,
NAME = 'Full Backup of database_name';
GO

Example :

USE StudentRegistration;
GO 

BACKUP DATABASE StudentRegistration
TO DISK = 'D:\DBBackup\StudentRegistration_20170719.Bak'
WITH FORMAT,
NAME = 'Full Backup of StudentRegistration';
GO

1 comment:

  1. This error is coming while restring database.

    RESTORE DATABASE is terminating abnormally.

    ReplyDelete