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)

SQL Documentation, SQL Download, SQL Sample Database, SQL Server
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

  • Hi Pinal,

    While trying to attach the file..getting some error…!
    I am using CTP3.

    CREATE DATABASE AdventureWorks2012
    ON (FILENAME = ‘D:\AdventureWorks2012_Data.mdf’)
    FOR ATTACH_REBUILD_LOG ;

    Can you please suggest how to fix this issue?

    Reply
  • Hey Pinal,
    Great blog duuuude..How about that picture on the banner..eh?
    Can you change it to a recent one from facebook?

    Reply
  • Any advise to my issue ?

    Reply
  • i’m having difficulty with the path, it’s telling me access denied

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

    Reply
    • As a few other users have said…. (1) copy the .mdf data file to C:\Program Files\Microsoft SQL Server\MSSQL11.SQLEXPRESS\MSSQL\DATA ……. note that I am running the Express edition on my PC
      (2) You have to run sql management studio as Administrator. Right click SSMS and select ‘Run as Administrator’
      (3) Open a new query and Use Pinal’s script specifying the “FileName” as your full location path…..in step 1 above
      (4) You will get a message as the following but the database will have been created at this point so you don’t need to worry…..File activation failure. The physical file name “C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\AdventureWorks2012_Log.ldf” may be incorrect.
      New log file ‘C:\Program Files\Microsoft SQL Server\MSSQL11.SQLEXPRESS\MSSQL\DATA\AdventureWorks2012_Data_log.ldf’ was created.
      Converting database ‘AdventureWorks2012’ from version 705 to the current version 706.
      Database ‘AdventureWorks2012’ running the upgrade step from version 705 to version 706.

      I hope this helps you.

      Reply
  • Damodar Karmacharya
    March 26, 2012 6:33 am

    Hi dee,

    You have to run sql management studio as Administrator.

    Best Regards,
    Damodar

    Reply
  • The script worked for me. Although I got the following message:

    Converting database ‘AdventureWorks2012’ from version 705 to the current version 706.
    Database ‘AdventureWorks2012’ running the upgrade step from version 705 to version 706.

    Reply
  • 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 705. This server supports version 655 and earlier. A downgrade path is not supported.

    — i have SQL server 2012 express. I get teh same error when i try to attach it from the UI.

    Reply
  • Duncan Lawrence
    April 18, 2012 12:15 pm

    I Get the same 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 705. This server supports version 663 and earlier. A downgrade path is not supported.

    Reply
  • i’m having difficulty with the Access, it’s telling me access denied
    Run sql management studio as Administrator. But no use.
    Msg 5120, Level 16, State 101, Line 4
    Unable to open the physical file “C:\DB\AdventureWorks2012_Data.mdf”. Operating system error 5: “5(Access is denied.)”.

    Reply
  • like always it was exactly what i needed. thanks!

    Reply
  • I worked for me, just need to copy the data file to the data path (C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA) and run the Management Studio as Administrator.

    Reply
  • Lee McIntosh (@lee_mcintosh)
    May 4, 2012 6:34 pm

    For those having Access is Denied issues try the following:

    Right click the mdf file > Security > Edit > Owner Rights: Full Control > Apply > OK > Apply > OK.

    Reply
    • Awesome Lee! This worked for me. I changed the security to “Full Control” just like you said, and he DB loaded :-). Thanks for being so precise in you instructions.
      Bob

      Reply
    • Manuel J. Herrera (@EndyMX)
      August 16, 2013 3:51 am

      So awesome, more than a year later, your commentary was helpful, thank you! And thank God for the Internet! :P

      Reply
    • Tanx Lee..It works super fine for me ..:)

      Reply
  • Anybody face this error ?
    —————
    Could not continue scan with NOLOCK due to data movement.
    Could not open new database ‘AdventureWorks2012’. CREATE DATABASE is aborted. (Microsoft SQL Server, Error: 601)
    ————-
    (Already build ldf)

    Reply
    • I think it is due to either your database is offline, or the server connectivity got down

      Reply
  • The AdventureWorks database simply does not work! Using full admin permissions doesn’t work either. It was simply shipped “f’d” up!

    Reply
  • 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 705. This server supports version 655 and earlier. A downgrade path is not supported.

    Reply
    • I faced the same issue but i had not installed 2012 RTM.

      –>First make sure that you have installed sql server 2012 RTM.
      –>Then, Like peizhen said just copy the AdventureWorks2012_Data.mdf to (C:\ProgramFiles\MicrosoftSQLServer\MSSQL11.MSSQLSERVER\MSSQL\DATA) and run the Management Studio as Administrator.

      Hope this helps…

      Reply
    • It means you are trying to restore the database with higher version to the lower versioned server

      Reply
  • Please help with this error!

    Reply
  • Thanks for this blog entry Pinal. It was a big help!

    Reply
  • hello sir, i am a beginner for sql server…please tell me from where i can learn it and which platform will be better to learn it. please guide me …thank you

    Reply
  • If you’re using sqlserver 2008r2 download the 2008R2 compatible file instead ==> https://archive.codeplex.com/?p=msftdbprodsamples

    Reply
  • I am using MS SQL Server 2012 Express and this work. Just make sure you put the right path, the file in the right folder and in the right instance if you have several instances. In addition, run the database as Administrator.

    Reply

Leave a Reply