How to Create a Database Backup in SQL Server using SQL Scripts?

You can create a Database Backup in SQL Server easily by using the SQL Scripts.

Just specify the BACKUP DATABASE statement by simply specifying the name of the database to backup and the path where the backup should be created.

BACKUP DATABASE <database name>
WITH <Options>

The BACKUPDEVICE specifies the device used for backup operation. You can use DISK or TAPE option here.

The WITHspecifies various options like Compression, Description, Name for the backup set etc.

Below is a sample backup database statement used to back up the TEST database.

TO DISK = 'E:\TEST1.Bak'
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

Leave a Reply


Interesting BlogPosts to read

Dealing with the column names that looks like SQL Keywords in SQL Server
There are times when you might have a column names in your SQL Server database table that might look...
SQL Server's ISNULL() equivalent in PostgreSQL
SQL Server provides an function ISNULL if the value placed in the 2nd parameter if the first paramet...
Kill all the current active connection in SQL Server database
There are times when you want to kill all the current active connections of your SQL Server database...