In this tip we will understand how to attach a database. I took Adventureworks2012 database Mdf file which we need to attach.
Now do follow steps
1) Open the sql server and right click on Database folder of object explorer window.
When you right click you will get a menu as shown below
2) When you click on Attach menu you will get a new window which is shown below
3) Now I click on Add button and select the Mdf file which you want to attach in my case I added Adventuresworks2012.mdf file which is on D drive. Once I added that file I got following screen as shown below
4) Now click on OK button below when you click it your database will stored (attached) in SQL Server as shown in figure
Hope it will help you
Enjoy !!!