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

  • Nice and good information, i need this info thanks

    Reply
  • my sqlserver don’t be installing this masassage always show when i need installing and i can’t solved this problem
    the massage is “rule “pervious releases of microsoft visual studio2008″ failed
    a pervious realease of microsoft visual studio2008 is installed on this computer . upgrade microsoft visual studio 2008
    to the sp1 before installing sql server 2008”
    i need help please

    Reply
  • Nice write up. Very informative.

    Reply
  • Congratulations, very clear your article.

    Reply
  • I want to sql server2008 for use my compony

    Reply
  • hi thanks for the information placed in ur blog
    it helped me a lot in installing adventure works in my sql server data base
    i appreciate the way u share data with every one

    Reply
  • thx alot

    Reply
  • Hi, when installing the AdventureWorks2008_SR4 i have this error:

    Fatal error occurred during installation. Details:

    Error de la inicializacion del objeto 8ISupportInitialize.EndInit). Error al recuperar un generador de classes COM para el componente con CLSID {4590F811-1D3A-11D0-891F-00AA004B2E24} debido al siguiente error: 80004002. Error en el objeto ‘DatabaseSelection’ en el archivo de marcado ‘DatabaseInstaller;component/databaselection.xaml’ Linea 78 Posicion 3.

    Im using win7 ent. 32bit

    Reply
  • thank you, this post saved me a lot of time. :)
    instructions are precise and concise
    tyvm

    Reply
  • I just wanted to add my thanks to all the others.
    I was in dispair and then found this.
    Just one point when the instanwind.sql file was loaded in SQL server there was no occurrence of SET @data_path so I was thinking “oh oh, here I go again”, but being desparate I ran it anyway and it worked.
    It was there in my databases and eventually I could connect to it after I had reversed some configuration settings I had tried earlier.
    Now I can connect in Visual Studio too.
    Thanks again.

    Patrick

    Reply
  • can’t find the @data_path variable. will u plz mention in which line it is?

    thanks in advance,
    syamantak

    Reply
  • no commamt

    Reply
  • i want sql server now

    Reply
  • Sorry, but I do not see any of these install files under Downloads & Files as the codeplex site

    Thanks

    Reply
  • i need download link where is it

    Reply
  • Jasvir Singh Bargari
    June 24, 2010 1:17 pm

    I have been trying to install the Sample Databases for SQL Server 2008 as suggested by you. The link “CodePlex SQL Server sample Databases” displays the following message:

    “This page has moved, please wait while we redirect you to the new page”.

    Please tell me from where I can download the sample databases for SQL Server 2008 Express

    Reply
  • I have been searching for AdventureWorks DB and Northwind DB. But I could not find both. Can anybody specify the Link to Download these DBs.
    Thanks.

    Reply
  • Reginold Mano Antony
    July 10, 2010 10:52 pm

    Awesome material, thank you very much for the info.

    Reply
  • Can you please give me the link to download AdentureWork Sample Database for SQL 2008, PLEASE.

    Reply
  • rebecca gurung
    July 31, 2010 2:19 pm

    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
    rebecca gurung

    date-31-07-2010

    Reply

Leave a Reply