SQL 2012 Sample Databases Adventure Works Download

Leave a comment (0) Go to comments

STEP BY STEP Guide for Downloading and Attaching SQL Server 2012 Sample Database

There are various ways to get SQL 2012 sample databases from codeplex.

  1. Download and Execute Database Scripts in SSMs.
  2. We can download the data file and attach to SQL Server.

Note – All other SQL Server 2012 Sample Database can be downloaded from here.

Solution 1 : Download and Execute Database Scripts in SSMs

STEP 1 – DOWNLOAD AdventureWorks 2012 Data Script

**This is approx 20 MB of file might take couple of second

STPE 2 - Extract the zip file a folder which has some .CSV data files and instawdb.sql, which will import these csv data in sql tables.

STPE 3 - Copy and execute instawdb.sql, in SQL Server management studio, which will create a database and related Schema and other database objects..

Solution2 : Download the data file and attach to SQL Server.


STEP 1 – DOWNLOAD AdventureWorks 2012 Data File

**This is approx 188 MB of file might take couple of second

STEP 2 – ATTACH downloaded SQL Server Adventure Works Sample database for 2012 to SQL Server

Quick note, the file which we downloaded is just a data file, so we can not attach or install this file. We need to manually attach this Data file to SQL Server to build a AdventureWorks Sample Database.

To build a database from a data file, we need to ATTACH Database data file, to  attach, Right Click on SSMS >> Database >>> ATTACH

SQL 2012 Sample Databases Adventure Works Download sql server sample database download

In attach Window Locate a Data file which we downloaded in STEP 1

SQL 2012 Sample Databases Adventure Works Download sql server sample database download

In the Attach Databases window; We will see that SQL Server informs us that the log file is not found. In order to attach the database without Database LOG File, we need to select the file as highlighted in the below snippet and click the "Remove" button and finally click OK to attach AdventureWorks database without the transaction log file and click OK

SQL 2012 Sample Databases Adventure Works Download sql server sample database download

SQL 2012 Sample Databases Adventure Works Download sql server sample database download

This will create a New database to our SQL Server as expected.

SQL 2012 Sample Databases Adventure Works Download sql server sample database download

Alter natively, Instead of Graphical tool, we can run the following TSQL Script to attach SQL Server 2012 Sample Database, which I like the most and fast.

USE [master]
GO
CREATE DATABASE [AdventureWorks2008R2] ON
( FILENAME = N'C:\MSSQL\Data\AdventureWorks2008R2_Data.mdf' ),
FOR ATTACH_REBUILD_LOG ;
GO

This will create SQL 2012 Sample Databases Adventure Works in specified SQL Server.

EOF - SQL 2012 Sample Databases Adventure Works Download, SQL Server 2012 , 2008 R2 , 2008 , 2005 , 2000

Leave a Reply

Your email address will not be published. Required fields are marked *


*


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Notify me of followup comments via e-mail. You can also subscribe without commenting.