How To View Mdf

Table of contents:

How To View Mdf
How To View Mdf

Video: How To View Mdf

Video: How To View Mdf
Video: How to open an .MDF file? (Attach a Database in SQL Server) 2024, December
Anonim

Microsoft SQL Server DBMS is one of the most powerful and most flexible solutions among modern SQL servers serving relational databases. The bulk of Microsoft SQL Server database data is stored in mdf (Master Database File) files. Such files can be viewed by attaching them to a running server.

How to view mdf
How to view mdf

Necessary

  • - installed and running Microsoft SQL Server on a local machine;
  • - installed application SQL Server Management Studio.

Instructions

Step 1

Connect to SQL Server. If SQL Server Management Studio is already running, select File and Connect Object Explorer… from the menu. The Connect to Server dialog will be displayed. Also, this dialog is displayed automatically immediately after starting the application.

In the Server type drop-down list in the Connect to Server dialog, select Database Engine. In the Server name field, enter the name of your computer. Select an authentication type from the Authentication list. If you selected SQL Server Authentication, enter your server credentials in the User name and Password fields. Click the Connect button.

Step 2

Begin the process of attaching the database. In the Object Explorer pane, right-click on the Databases item. In the context menu, select the "Attach …" item.

Step 3

Specify the mdf file of the database, the contents of which you want to view. In the displayed Attach Databases window, click on the "Add …" button. The Locate Database Files dialog will appear. In the Select the file directory tree of this dialog, find and expand the node corresponding to the directory where the target file is located. Highlight the file. Click OK.

Step 4

Add the database to the server. In the Attach Databases window, in the Databases to attach list, select the element corresponding to the mdf file specified in the previous step. Review the contents of the Database details list. If it contains items whose Message field contains the text Not found, remove them. To do this, select the elements with the mouse and click the Remove button. Similar items are added for non-existent database log files. Click OK.

Step 5

Review the structure of the database contained in the mdf file. Expand the Databases node in the Object Explorer pane. Expand the node corresponding to the previously added database. View the contents of its child nodes. For example, the Tables section contains items corresponding to the database tables, the Views section contains mappings, and the Programmability section contains all the functions, types, stored procedures, and triggers in the database.

Step 6

View the contents of specific database objects in the mdf file. In the Object Explorer pane, select the item of interest (for example, a table or display) and right-click on it. In the context menu, select the item starting with the word Open (for example, Open Table or Open View) to view and possibly edit the data, or the Modify item to view and edit the SQL code.

Recommended: