SQL SERVER – Download and Install Sample Database AdventureWorks 2005 – Detail Tutorial

Just a day ago I received a question from a reader who just installed SQL Server 2008. After the installation user did not find any sample database along with installation. The user wants to install the sample database which he is very much used to. Let us learn about Sample Database AdventureWorks.

Here is a quick tutorial how one can install the AdventureWorks database on your server.

In the year 2016 Microsoft has replaced AdventureWorks with WideWorldImports database. You can read about that over here: Download and Install Sample Database WideWorldImporters

Sample database is now moved to Microsoft’s open source site of Codeplex. Visit following link to visit the Sample Database page.

There are two different methods to set up sample database. 1) Running SQL Script 2) Restoring Database Backup. There are a few common steps in both the process. We will see the common process first and then after see both the method to set up a sample database in detail.

Common Steps:

Download the .msi package based on your operating system and your SQL Server version. I have used AdventureWorks DB version of 2005 as that is what was questioned from user. If you download version of 2008 it can only be installed in version of 2008.

Most of the images are self-explanatory so I will let images explain most of the details.

SQL SERVER - Download and Install Sample Database AdventureWorks 2005 - Detail Tutorial samples2008

SQL SERVER - Download and Install Sample Database AdventureWorks 2005 - Detail Tutorial samples20081

SQL SERVER - Download and Install Sample Database AdventureWorks 2005 - Detail Tutorial samples20083

SQL SERVER - Download and Install Sample Database AdventureWorks 2005 - Detail Tutorial samples20085

SQL SERVER - Download and Install Sample Database AdventureWorks 2005 - Detail Tutorial samples20086

SQL SERVER - Download and Install Sample Database AdventureWorks 2005 - Detail Tutorial samples20087

Above image displays the location where Sample Database is installed. Please note the location of the same database as “C:\Program Files\Microsoft SQL Server\100\Tools\Samples\AdventureWorks OLTP

Method 1 : Using T-SQL Script

Open SQL Server Management Studio and open the file instawdb from the location where sample database are extracted “C:\Program Files\Microsoft SQL Server\100\Tools\Samples\AdventureWorks OLTP“.

SQL SERVER - Download and Install Sample Database AdventureWorks 2005 - Detail Tutorial samples20088

SQL SERVER - Download and Install Sample Database AdventureWorks 2005 - Detail Tutorial samples20089

Now make sure that you find variable @data_path and change its values to the location of the database. This is very important task otherwise your database will be created with empty tables.

SQL SERVER - Download and Install Sample Database AdventureWorks 2005 - Detail Tutorial samples200810

Once the script is successfully running, following result set will be returned.

SQL SERVER - Download and Install Sample Database AdventureWorks 2005 - Detail Tutorial samples200811

Check AdventureWorks database in object explorer.

SQL SERVER - Download and Install Sample Database AdventureWorks 2005 - Detail Tutorial samples200812

Method 2 : Restoring Database Backup

This method requires to create empty database initially and then after restoring it from backup. Please pay attention to radio buttons and checkbox on the screen as it is very important to select the right options when restoring database.

SQL SERVER - Download and Install Sample Database AdventureWorks 2005 - Detail Tutorial samples200813

SQL SERVER - Download and Install Sample Database AdventureWorks 2005 - Detail Tutorial samples200814

SQL SERVER - Download and Install Sample Database AdventureWorks 2005 - Detail Tutorial samples200816

Location of Database backup is where sample database is extracted “C:\Program Files\Microsoft SQL Server\100\Tools\Samples\AdventureWorks OLTP“.

SQL SERVER - Download and Install Sample Database AdventureWorks 2005 - Detail Tutorial samples200817

SQL SERVER - Download and Install Sample Database AdventureWorks 2005 - Detail Tutorial samples200818

The following screen is most important, make sure to select options displayed in the screen or database will not be restored.

SQL SERVER - Download and Install Sample Database AdventureWorks 2005 - Detail Tutorial samples200820

SQL SERVER - Download and Install Sample Database AdventureWorks 2005 - Detail Tutorial samples200822

Check AdventureWorks database in the object explorer.

SQL SERVER - Download and Install Sample Database AdventureWorks 2005 - Detail Tutorial samples200823

If you want to install AdventureWorks database version 2008, the methods works fine. There is an additional sample database are available in the same package and they can be installed in a similar way. If you want to install Northwind database follow my previous article SQL SERVER – 2005 NorthWind Database or AdventureWorks Database – Samples Databases – Part 2.

Let me know what is your experience while setting up a sample database with SQL Server 2008. Additionally, let me know what you think about this in-depth explanation of the process of setting up sample database.

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

Database, SQL Backup, SQL Download, SQL Restore, SQL Sample Database, SQL Scripts, SQL Utility
Previous Post
SQLAuthority News – Security Update for SQL Server 2000 Service Pack 4 and MSDE 2000
Next Post
SQLAuthority News – SQL Server 2008 Downloads Availables

Related Posts

132 Comments. Leave new

  • Thanks Pinak for your blog Its amazing.
    Just wanted to know what is SQL Server 2008R2
    I want to download the sql server 2008 to tral version where cani can the full donwload
    Thanks in advance.
    Nagesh

    Reply
  • Thanks Pinal..

    Reply
  • plz sent to me sql server 2008 r2 full source plz

    Reply
  • sql server data base

    Reply
  • Andrey Ufimtsev
    October 15, 2010 6:03 am

    Lots of people complain about ‘Component/databaseselection.xaml line 78 position 3’ problem. I had the same problem, just solved it by stopping all SQL Servers except the one where I supposed to install those examples. Actually I have SQL Server 2008 Express and SQL Server 2008 Standard. They where running under different accounts Network Service and LocalSystem accordingly. Maybe the problem was different accounts, I did not investigated this, I just stopped SQL Server 2008 Express and run installation again – it worked.

    Thanks,
    Andrey

    Reply
  • Dinkar Chalotra
    November 10, 2010 7:19 am

    Hi Pinal,
    I upgraded SQL Server 2005 standard edition to SQL Server 2008 Standard edition. But problem is that old version of SQL Server 2005, i can still access it..means it is still there in start>>Programs.

    Why is that?
    Any help will be highly appretiated.
    Thank You.

    Dinkar

    Reply
  • hello sir,
    kindly plz suggest me a site through which i can download the free SQL SERVER..
    plz do let me know the full version and the path so that i can download it right away as it seems to very complicated..
    Thanking You,
    yours sincerely
    Hamid Ali

    date-31-07-2010

    Reply
  • Dave,
    I am interested in downloading adventureworks 2008
    LT R2. Can you do a manual Command LIne Prompt using Visual studio aspnet_regsql for sql membership (I do not wish to use the wizard? How is this done? Thank you…

    Reply
  • Hi Dave,

    I am having a devil of a time with the 2008R2 version. There is not a AdventureWorks OLTP file on my AdventureWorks download.

    Is this part of the 2008R2 AdventureWorks? Am I missing something from the 2008R2 SQL Server?

    Thanks,

    Lisa

    Reply
  • Thank you sir.

    We love you …

    bye bye

    Reply
  • CodePlex SQL Server Sample Database

    link is not working….

    I want adventurework database for readin 70-433.

    Reply
  • when try to attach Adventureworks in SQL server 2008 Standerd edition this error is occuring :

    CREATE FILE encountered operating system error 5(Access is denied.) while attempting to open or create the physical file ‘C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AdventureWorks_Data.mdf’. (.Net SqlClient Data Provider)

    Can you tell me how to solve this problem???

    Reply
  • Hi PinalSir,

    Reply
  • Hi PinalSir,

    i Downloaded Adventure works and now i am going for method two to install it i created a databs manually which is empty now i am trying to pass a file from “FROM DEVICE ” option like you have shown in snap.

    but it is asking for BAK file and i dont have bak file as i had .mdf and .log files so can u suggest me how i can get through this??/

    THANKS and REGARDS
    Kamesh Shah

    Reply
  • The database is not available at the link specified here. I want the AdventureWorks Database for SQL Server 2008 and I am using windows 7 64 bit ultimate.. please tell me where can i find it.

    Reply
  • Please update with new version

    Reply
  • Thank you. Method 1 worked well for me. I could run it after I enabled the environment variables that were commented out at the top of the script. I used the latest 2008 R2 Aventureworks Db.

    Reply
  • hi mr pinalsir,
    thank you, your article is very helpful. :)

    Reply
  • Really This is very nice step by step learning .
    thank you.

    Reply
  • hi i am kanji
    how to download SQL Server managemant studio
    and how to instolation to pc

    Reply

Leave a Reply