Attach Database In Sql Server Step by Step – Programming, Pseudocode Example, C# Programming Example

Attach Database In Sql Server Step by Step

In this tutorial we’ll learn how to attach a database in sql server.

We will use our library database for example.

you can download library database from here.

  1. First extract the LibraryDatabase file
  2. Copt the library.mdb and library_log.ldf files to C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA folder.If the program asks you for administrator permission, click the yes button.
  3. Than run the sql server 2014 and connect the database.
  4. Right Click databases at Object Explorer toolbar.

  1. Then Click Attach…

7. Then Click Add Button…

  1. Make sure it is in the Data folder: C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA

  1. Select Library.mdf and Click OK button.
  2. You will see the database’s files at the bottom.(Library.mdf and library_log.ldf)
  3. When you click OK button the library database will be list in Object Explorer Toolbar / Databases.
  4. That is all. You can use the database right now.


  • What are your copyright restrictions? I would like to use your decimal.SquereRoot(decimal d) function in my code. I’m hoping I can do so with
    citation in my summary. It would be posted in VS Community section of Git.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: