How To Export SQL Server Database As .MDF File

Sometimes our requirements are related to opening the existing database on some other location system so that we can access it or we can further modify it. For this SQL Server Management Studio 2014 provides the functionality to perform this task.

Exporting a database is very important in cases where DBA or developer or any user has to access it on any other location.

Example: Working on any database at office or college or at home, if you want to export and open that database so that you can use later on, you need to understand the steps to export the database.

Here are the steps stating the procedure of exporting a database,

Firstly, go to SQL Server Management Studio, right click on your database and select properties. Now select File menu,

1

In File option, you need to get the Path of database saving location with files name saved as .MDF and .LDF files.

Second, Open the path location as given in above pic and copy both the .mdf and .ldf files of database that you want to export.

2
Third, before copying .mdf file and .log file on your system please Stop services of your SQL Server,
To Stop services: Search Services in your system search option, then select your Sql Server Name and right click on its Properties and click Stop option.

Example

stop services


Fourth, now the database files (.mdf and .ldf) are saved on your system. Just copy them to other places through pendrive or email or any other way to export the database to destination system.

Example

3

Fifth, Now on your destination system just copy or cut and paste both the .mdf and .ldf database files in to the MS SQL Server path location on your system:

5
Sixth, Open your SQL Server Management Studio 2014 of destination system, here right click on Databases folder and select Attach option.

4


When you clicked Attach, a window will open, In this just click on Add button, select the database .mdf and .ldf files and add it.

6

Just Refresh your databases, You can see that in below pic the database Trainee is exported from other system, now we can access its objects.

7


Similar Articles