Backup Database using SQL Query

In the last post, we have backed up the database using the SQL Server Management Studio.

Now we are going to do the same using SQL Query.

If you want to extract the Query that the SQL Server is using when backing up a database, it is simple.

Right Click on the Database, –> Tasks –> Backup. This will open the Backup database window.

On the top of Back up database window, Click on the Script button and select option, “Script Action to New Query Window”



This will give the SQL Query to backup that database in the new query window.

BACKUP DATABASE [AdventureWorks2008R2]
TO DISK = N'D:\SQL DB\BACKUP\AdventureWorks2008R2.bak'
NAME = N'AdventureWorks2008R2-Full Database Backup',
STATS = 10

Give the Path and Name for the backup in the query and Run this query. This will take the backup of that database in that path.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s