Take Database Backup via SQL Query in SQL Server

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.

Select the database in SQL server and click on the New Query

(4) After that new query editor open as shown.

new query editor open in sql

(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.

sql databse full backup and differential backup query execute

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

Purchase Received not Invoiced Report in BC D365
Convert Amount into Words in D365 BC
Purchase Order Short Closed Feature in BC D365
DELETE and DELETEALL in D365 BC
Getting Started with AL– Microsoft Docs

Leave a Reply