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

  • I installed Microsoft SQL server 2008 I have adventure work database that I want to install, I am not sure how to install it can u give more description of how to do it.

    Reply
  • Trying to install the adventure work dbase using the 2nd method however i am not locating the backup file. I am using the installer packaged dwnloaded from codeplex. Is there something i am doing wrong as this is getting VERY frustrating.

    Reply
  • need sql server software

    Reply
  • Danish Ahmed Siddiqui
    April 18, 2012 5:54 pm

    Danish Ahmed Siddiqui

    Unable to open the physical file “D:\Tech\umbraco\build\App_Data\umbraco.mdf”. Operating system error 5: “5(Access is denied.)”. (Microsoft SQL Server, Error: 5120) please help me on it

    Reply
  • Thanks!

    Reply
  • Hi want to download SQL Server 2008 Express Edition, how do i go about it please help

    Reply
  • link is dead

    Reply
  • The specified release was not found. on link

    Reply
  • Haseeb Ahmed
    July 21, 2012 3:55 pm

    link is down

    Reply
  • Atique Ahmed
    July 22, 2012 1:26 pm

    Can any one suggest a good site to learn SQL Server 2008. There are many articles in the web, most of them will jump into conclusion too soon….
    Thanks in Advance!!!

    Atique

    Reply
  • Sir kindly tell me the procedure how i use adventure works sample files in my real environment.Thanks

    Reply
  • mustapha ahmed ibrahim
    September 8, 2012 2:12 am

    i want to download SQ L server 2008

    Reply
  • I m finding difficulty to attach all sample databases download from code plex,
    Error message displays as version of sql currently is lower version 661
    the server supports 654 version .

    could u provide Downloadlink .

    Reply
  • thanks alot

    Reply
  • i want to download adventureworks but i dont now how to download

    Reply
  • For all those who want to download SQL Server 2008, Express editions are available for free at Microsoft Download Centre website. Here is the direct link to download SQL Server 2008 R2 Service Pack 2 – http://www.microsoft.com/en-in/download/details.aspx?id=30438

    Similarly, R1/SP1 for 2008 and previous versions of SQL Server are also available.

    Please read the overview section and the information below that to understand the best product suitable for your use as there are multiple options available for download at each link (for e.g. SQL Server 2008 R2 Express with Tools / with Advanced Services / (Runtime Only) / Management Studio Express)

    P.S. – A little bit of google search before asking for help never hurts.

    Reply
  • Hi,

    I have add to above sample database but it always shows that it is read only.
    Can someone help me ?

    Reply
  • Can you please share the link of SQL server 2008 standard edition for download.

    Reply
  • oh thank you. i were searching for this one. Before i download this i coudn’t attach the adventure works.mdf file. Now am happy to see this adventureworks.BAK file……thanks alot

    Reply
  • Thanks!

    Reply

Leave a Reply