Take Database Backup via SQL Query in SQL Server:
(1) “BACKUP DATABASE” statement is used to take a full backup of an existing database.
(2) Syntax of “BACKUP DATABASE”& DIFFERENTIAL statement is:
BACKUP DATABASE database_name TO DISK = ‘PathOfFile’; BACKUP DATABASE database_name TO DISK = ‘PathOfFile’; With DIFFERENTIAL |
(3) Select the database in the SQL server and click on the “New Query” button as shown.
(4) After that new query editor open as shown.
(5) After doing the above steps, write a query in the editor and execute the query. After this SQL Server takes and saves the backup of the database in the defined path. In the below image we will take backup in two different ways, one is “Full Backup” and the second is “Differential Backup” which means only changed values as shown.
Source Code:
–//Full Backup Query BACKUPDATABASE [Demo Database BC (18-0)] TODISK=’C:\Desktop\MyFirstBackUp.BAK’; –//Full Backup Query –//Differential Backup Query BACKUPDATABASE [Demo Database BC (18-0)] TODISK=’C:\Desktop\MyFirstBackUp.BAK’; WithDIFFERENTIAL; –//Differential Backup Query |