Aspdotnet-Suresh

aspdotnet-suresh offers C#.net articles and tutorials,csharp dot net,asp.net articles and tutorials,VB.NET Articles,Gridview articles,code examples of asp.net 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

Take Database Backup in SQL Server 2008 using Query or Management Studio

Apr 21, 2015
Introduction:

Here I will explain how to write query to take database backup in
sql server or take backup of database using sql server management studio. To take database backup in sql server we need to write query like “BACKUP DATABASE DatabaseName to Disk…etc” or directly from management studio we can take backup  in sql server.
Description:                           
In previous articles I explained SQL injection attacks with example, SQL Server interview question and answers, joins in sql server, function example in sql server 2008, Primary key constraint in sql server, foreign key constraint in sql server, cursor example in sql server and many articles relating to SQL server. Now I will explain how to write query to take database backup or take database backup from sql server management studio 2008.

To take database backup from sql server we have different methods

       1.    With Query
       2.    Directly from sql server management studio

With Query to take database backup:

To take database backup by using sql server query we need to write the query like as shown below

Syntax of Query to take database


BACKUP DATABASE DatabaseName TO DISK ='PATH TO STORE'

Example:


BACKUP DATABASE MySampledb TO DISK ='E:\mysampledb.bak'

Once we run above query we will get output like as shown below and it create database backup in respective folder path


If you check your folder path database backup file will exists.

Directly from SQL Server Management Studio

To take database backup directly from sql server management studio we need to follow below steps

Open sql server management studio à Select your database à Right click on it and select Tasks in that select Backup and click on it like as shown below

 
Whenever you click on Back Up option it will open new window in that keep Backup type as full and add destination folder path to save backup file for that click on Add button to add destination folder path like as shown below



Now select destination folder path and give file name like as shown below and click OK



Once we add our destination folder path that will be like as shown below



Now click OK it will create database in your destination folder check it….

If you enjoyed this post, please support the blog below. It's FREE!

Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email

2 comments :

Eagle360 said...
This comment has been removed by the author.
Eagle360 said...

nice post sir...but sir how to take backup of database in the form of .mdf format?
the query is as following
BACKUP DATABASE DatabaseName TO DISK='E:\DatabaseName.mdf'

Give your Valuable Comments

Note: Only a member of this blog may post a comment.

© 2015 Aspdotnet-Suresh.com. All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.