This tutorial helps you to get Adventure Works database added to your SQL Server 2012. First thing we need to do is to download the sample database from Microsoft’s website:

http://msftdbprodsamples.codeplex.com/releases/view/55330

On the website, you will see a link to AdventureWroks2012 Data File:

image

After you have download it, follow these steps:

1. Copy/Move the Data File to the SQL Server DATA directory.

The directory structure for a SQL Server 2008 R2 named instance that includes the Database Engine, named “MyInstance”, and installed to the default directories would be as follow:

C:\Program Files\Microsoft SQL Server\MSSQL10_50.MyInstance\

Note: I am using SQL Server 2012 Express and I have changed my default directory for DATA

 

2. Open SQL Server Management Studio (SSMS) and Right click on the Database folder then click on Attach:

image

3. A window will open to add your MDF file. Click on Add button:

image

4. Since you copied Adventure Work Data File (.MDF) to the default DATA directory, it will appear under the DATA directory. Select AdventureWorks2012_Data.mdf and click OK:

image

5. A log file could be automatically added for you. Since this is the first time we are adding this Data File, there is no Log file. Therefore, select the Log entry and click on Remove to delete it. Then click on OK to proceed.

image

6. You have now successfully added Adventure Works to your Database and you can see it listed under your Databases folder in your Object Explorer:

image

7. You can also see that SQL Server added a log file for your new .mdf file which you just added:

image