Home » SQL Server » How to Import MDF database in SQL Server – Know Complete Solution

How to Import MDF database in SQL Server – Know Complete Solution

Shini Mohan | Modified: 2021-10-15T11:03:48+00:00|SQL Server | 3 Minutes Reading

Summary: This post is intended for the users looking for a solution to Import MDF database in SQL Server 2019, 2017, 2016, 2012, and others. It blog describes the manual approaches to restore the database. But in case if have corrupt database files then users can take the help of an expert solution.

SQL Server is a widely used application which is used by many small and large-scale industries/organizations. It saves all the data in MDF (Primary Database file) file format. It also uses another file to store the transaction details which is known as LDF or log file. Database inaccessibility is a common problem for SQL administrators. Sometimes corruption issues might occur due to various reasons such as virus attacks, bugs, system failure, etc.
There are situations when a user wants to import MDF database in SQL Server 2012. In the upcoming segment, we are going to discuss the best possible solutions to let users understand the complete restoration process in a simple and effective way. So, without any further ado let’s dig in.

Import MDF Database in SQL Server – Using SSMS

Follow the instructions carefully to restore MDF database file.

  • First of all, launch SQL Server Management Studio in your computer system.
  • Under Object Explorer, right-click on the Database folder and click on the Attach option from the drop-down menu.
  • An Attach Databases wizard will appear on the user’s screen, click on the Add button.
  • Browse the location of the database MDF file, select the desired file you want to restore, and then hit the OK.
  • Now, the database details will appear on the Attach Database screen, here you notice the Log file is missing.
  • After this, Select the LDF file and click on the Remove button. Finally, press the OK button to restore the SQL MDF file.

What to do if the database file becomes corrupt?

The manual solution does not work if the database files get corrupted. In such situations, it is suggested to use SQL Recovery Tool to repair and import MDF database in SQL Server. This is a reliable and easy solution to attach only MDF without any technical expertise. It comes with a simple and graphical interface that inexperienced users who do not have relevant experience can easily use the tool.

This software supports to repair MDF file along with all data such as tables, rules, triggers, functions, and other components. It is compatible with all versions of Microsoft SQL Server 2019, 2017, 2016, 2014, 2012, 2008, and all earlier versions. The tool not only recovers the damaged or corrupt MDF file but also recovers the permanently deleted data of the SQL Server.

Download Now Purchase Now

Let’s explore the steps to Import MDF database in SQL Server

1. Download the tool and then add the file into the tool using the Open button.

 Import MDF database in SQL Server
2. Choose Scan mode as per the corruption level and then select the server version also.

Import MDF database in SQL Server
3. Preview the complete data on the software interface and hit the Export button.

Repair MDF
4. The tool provides different export options, choose the SQL Server Database option and enter the required details for the authentication.

 Import MDF database in SQL Server
5. Now, select the required database items and then click the Export button.

Import MDF database in SQL Server


Well, in this blog we have explained different approaches to Import MDF database in SQL Server. Both manuals, as well as automated methods, are described above in a detailed manner. You can use any of the mentioned methods as per your need. In case if you have a corrupt database file then it is suggested to use the automated solution for quick and accurate results.