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

  • 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
    Kanji Dabhi

    date-14-03-2011

    Reply
    • Here is SQL Server 2008 express link with Management Studio. I know your question was asked a while back, but in case you are still looking, here you go

      Here is the 64 bit version

      Reply
  • hi dear i want ur Demo plz Send me this Demo dear ur Demo is very usefull for Every Person

    Reply
  • where we can find SQL2008.AdventureWorks DB Script v2008.x86.msi

    Reply
  • SQL2008.AdventureWorks DB Script v2008.x86.msi
    is not there anymore, anyone can provide a sample to me? plz send to [email removed]

    Reply
  • Sunil Kumar Kaushal
    May 16, 2011 3:46 pm

    Hi All,

    Please let me know how can I add server on SQL SERVER CLIENT 2000

    Regards,
    Sunil kumar Kaushal

    Reply
  • Thanks Pinal,

    I was trying to attach AdventureWorks2008 OLTP database on SQL Server 2008R2 but there is an incompatible version issue which did not go away even after applying all SPs.

    I successfully scripted the database in with the help of this article.

    Thanks again,

    Sena

    Reply
  • Thank you very much. You tried using SQL Server 2008? Intellisense drives me mad! Is there any way to deactivate it?

    Thanks, Tarrist.

    Reply
  • Hi All,

    Please let me know how can I add server on SQL SERVER CLIENT 2005

    Regards,

    jitendra patel

    Reply
  • Hi
    All

    I m finding difficulty to attach all sample databases download from code plex,
    Error message displays as version of sql currently is lower version 654 compared to the databases which i have downloaded these were new version 661

    any help……….

    thanks

    Reply
  • this is very good example

    Reply
  • thats the issue im facing any one please help us…………

    Reply
  • My sql server 2008 installation stops in between without any error.plss help

    Reply
  • I have installed AdventureWorks2008R2_SR1
    from https://archive.codeplex.com/?p=msftdbprodsamples
    its automatically install all sample DB to my local db machine.
    no additional setup..
    anyway thanks

    Reply
  • I tried to access the codeplex site for Adventureworks sample DB’s for a few different types, and each one times out. What’s up with that?

    Reply
  • I tired install AdventureWorks2008R2_SR1 but in starting fatel error ocuring and my database some tables are avlable but no data only structur.how happing i dnt knw
    how to install full sample database to my database ?

    Reply
  • hello sir, this is yeswanth, im working in a small it company, i have a small doubt, can i install sql server 2008 directly by downloading the software

    Reply
  • hi i would like if someone can sand me some tutorials or to tell me how to build a database for restaurant :)

    Reply
  • Veeresh kushwaha
    November 18, 2011 2:01 pm

    Hi Thanks for this

    Reply
  • sir while iam opening the sql2005 it will ask the password iam entering the password but it will be closed

    Reply
  • sir iam creating a database with name student in sql2008 i got an error at locate back up file iam not getting my data base on that so please help to solve this problem.,,,,,,,,,,,,,,

    Reply

Leave a Reply