SQL SERVER – Install Samples Database AdventureWorks for SQL Server

SQL SERVER - Install Samples Database AdventureWorks for SQL Server 10-800x450 AdventureWorks is a Sample Database shipped with SQL Server and it can be downloaded from GitHub site. AdventureWorks has replaced Northwind and Pubs from the sample database in SQL Server 2005. The Microsoft team keeps updating the sample database as they release new versions.

Update: Please refer this blog post for the updated instructions Download and Install Adventure Works 2014 Sample Databases.

You can download either of the data files and create a database using the same. Here is the script which demonstrates how to create sample database in SQL Server 2012.

Watch a quick video on the same subject.

Every new version of SQL Server should have its own Adventure Works database. The reason is that SQL Server comes up with new features with every version and most of the new features need a new dataset sample to demonstrate the capabilities of the features. This is the why every version of SQL Server has its own AdventureWorks database. SQL Server 2014 has many new features and to support that Microsoft has released new AdventureWorks 2014 Sample Database.

Please note that in SQL Server 2016 the same sample database is replaced by WideWorldImporters. You can read about that over here: Download and Install Sample Database WideWorldImporters

This database is a replacement of old sample database called AdventureWorks (Engine version) and AdventureWorksDW (Data Warehouse version).

Reference: Pinal Dave (https://blog.sqlauthority.com)

, , ,
Previous Post
SQL SERVER – SQL Server Performance: Indexing Basics – SQL in Sixty Seconds #006 – Video
Next Post
SQL SERVER – SQL Server Misconceptions and Resolution – A Practical Perspective – TechEd 2012 India

Related Posts

103 Comments. Leave new

  • It works……..Thanks

    Reply
  • Thank you! Newbie to sql.

    Reply
  • Awesome Blog!!! I was having the hardest time! Thank you!!!

    Reply
  • it works… if you have access issue… you need to copy the database to data folder….. Thanks.

    Reply
  • Anyone tried installing SQL Server 2008 or 2012 Enterprise trial onto Windows 7 Home Premium? I see no documentation that it is supported or not supported, but having many problems.

    Reply
  • guys, actually I’m having trouble attaching the 2012 databases using the above create/attach script. Anyone tried on a Windows 7 Home Premium OS?

    Reply
  • I made sure to install every available feature of SQL Server 2012, downloaded the AdventureWorks 2012 database to C: , opened SQL Server Studio as Administrator, and ran create/attach script. I keep getting File activation failure. The physical file name “C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\AdventureWorks2012_Log.ldf” may be incorrect.
    Msg 5123, Level 16, State 1, Line 1
    CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file ‘C:\AdventureWorks2012_log.ldf’.
    Msg 1813, Level 16, State 2, Line 1
    Could not open new database ‘AdventureWorks2012’. CREATE DATABASE is aborted.
    Based on Pinal’s example, the .mdf file doesn’t need to be in any specific folder, as long as I use the correct path in the create/attach script.
    Please, any advice?

    Reply
  • I also have a copy of this .mdf file in my Downloads folder. If I run this:
    CREATE DATABASE AdventureWorks2012
    ON (FILENAME = ‘C:\Users\Aitch\Downloads\AdventureWorks2012_Data.mdf’)
    FOR ATTACH_REBUILD_LOG ;

    I get the following error:
    Msg 5133, Level 16, State 1, Line 1
    Directory lookup for the file “C:\Users\Aitch\Downloads\AdventureWorks2012_Data.mdf” failed with the operating system error 5(Access is denied.).

    Reply
    • Go back to SQL Server Configuration Tool, re- set up the Log on account, use an account which you have data access

      Reply
  • I keep gettin this error …. Tried all sorts of things, none worked.

    Msg 1813, Level 16, State 2, Line 1
    Could not open new database ‘AdventureWorks2012’. CREATE DATABASE is aborted.
    Msg 948, Level 20, State 1, Line 1
    The database ‘AdventureWorks2012’ cannot be opened because it is version 706. This server supports version 655 and earlier. A downgrade path is not supported.

    Reply
  • Msg 5120, Level 16, State 101, Line 1
    Unable to open the physical file “c:\AdventureWorks2012_Data.mdf”. Operating system error 2: “2(The system cannot find the file specified.)”.

    I have this Error the file in c

    Reply
    • HydTechie (@HydTechie)
      February 3, 2013 4:55 pm

      I am also getting this error[Msg 5120, Level 16, State 101, Line 1
      Unable to open the physical file “c:AdventureWorks2012_Data.mdf”. Operating system error 2: “2(The system cannot find the file specified.)”.], can somebody help us out here??

      1. made sure admin and logon user has full control on directory, Tried from custom folder and also from C: SQL path
      2. Try to attach through IDE, same error..

      thanks in advance,
      HydTechie

      Reply
  • Rami El-Chafei (@rchafei)
    October 24, 2012 9:28 pm

    running the SQL management console as “administrator’ fixed the Operating system error 5: “5(Access is denied.)” issue .. Thank you all

    Reply
  • Worked for me. Excellent. I ran SSMS aas administrator.

    Reply
  • Nice post.It works well.thanks.

    Reply
  • this isn’t working…help

    while (dataReader.Read())
    {
    int departmentId = dataReader.GetInt32(0);
    string Name = dataReader.GetString(1);
    string GroupName = dataReader.GetString(2);
    Console.WriteLine(
    “DepartmentID: {0}\nID: {1}\n{2}\n”, Name, GroupName);
    }

    Reply
  • Msg 1813, Level 16, State 2, Line 2
    Could not open new database ‘MyAdventureWorks’. CREATE DATABASE is aborted.
    Msg 948, Level 20, State 1, Line 2
    The database ‘MyAdventureWorks’ cannot be opened because it is version 661. This server supports version 655 and earlier. A downgrade path is not supported.

    Reply
  • Now you have help me again,again and again on so many questions about SQL-Server. Now and here a gread THANKS!!!!!! for your work. J.M.-S.

    Reply
  • What a great post, thanks Pinal

    Reply
  • I copied file path of exact location of .mdf folder, Operating System error 2?
    Can you please explain.

    Thanks
    Chalrotte

    Msg 5120, Level 16, State 101, Line 1
    Unable to open the physical file “C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\SQLDATA\AdventureWorks2012_Data.mdf”. Operating system error 2: “2(The system cannot find the file specified.)”.

    Reply
  • Hi Pinal Dave,
    You are rocking… Ur blogs help me to resolve so many work place issues. Great. I have a query regarding Adventure works project. Does it comes with UI ? I mean front end as well ? I need a sample application which uses MS SQL to understand. Any pointers to this is really appreciated.

    Thanks again for great blogs :)

    Reply
  • Sherif Shousha
    March 5, 2013 12:11 am

    Just add full permission to your domain account on the directory where the MDF file exists

    Reply

Leave a Reply

Menu