How add sample database Adventure Works to SQL Server 2012?

Download from http://sqlserversamples.codeplex.com website AdventureWorks2012_Data.mdf file. I copy this file into backup folder of SQL Server 2012 path.

Copy this script. Your path may be other, so change it for yours.


CREATE DATABASE AdventureWorks2012
ON (FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL11.SQLEXPRESS\MSSQL\Backup\AdventureWorks2012_Data.mdf')
FOR ATTACH_REBUILD_LOG ;

Paste this code into query window and run it by means of Execute tool.

a1

a3

I f you see in tree of databases, you see new AdventureWorks2012_Data database.

a4

 

In backup folder in this time you see new log file:

a5