SQL BACKUP DATABASE

The SQL BACKUP DATABASE Statement

The BACKUP DATABASE statement is used to create a full back up of a database.

Syntax
BACKUP DATABASE databasename TO DISK = 'backupfilepath';

Example
The following SQL statement generates a full back up of "TestDatabase" database to the 'C:\SQLBackups\TestDatabase.bak' location:
BACKUP DATABASE TestDatabase TO DISK = 'C:\SQLBackups\TestDatabase.bak';

 

The SQL BACKUP WITH DIFFERENTIAL Statement

Taking a differential back up only backs up the changes of the database since the last full database backup.

Syntax
BACKUP DATABASE databasename TO DISK = 'backupfilepath' WITH DIFFERENTIAL;

Example
The following SQL statement generates a back up of "TestDatabase" database changes since last full database backup to the 'C:\SQLBackups\TestDatabase.bak' location:
BACKUP DATABASE TestDatabase TO DISK = 'C:\SQLBackups\TestDatabase.bak' WITH DIFFERENTIAL;