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:
On the website, you will see a link to AdventureWroks2012 Data File:
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:
3. A window will open to add your MDF file. Click on Add button:
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:
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.
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:
7. You can also see that SQL Server added a log file for your new .mdf file which you just added: