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

  • Hi,
    You’ll need to go to windows services and set the following service from disabled to manual then start it:
    SQL Full-test Filter Daemon Launcher(MSSQLSERVER).

    if you don’t have that installed rerun MSSQL 2008 and make sure you see the full-text search feature enabled…

    Reply
  • Pinal,

    I’ve googled this for many days and have not found an answer.

    When installing SQL Server Express 2008 with Advanced
    Services using bootstrapper or running the exe directly
    I receive ‘the downloaded file is corrupted’ or .net framework JIT error. Management Studio 2005 installs fine
    but 2008 fails to install.

    Thanks in advance for your assistance.

    Reply
  • Follow these steps to fix the ‘PrepInstance() failed for MSSQLSERVER’ issue…

    1. Open SQL Server Configuration Manager

    2. Right-click on SQL Full-text Filter Daemon Launcher(MSSQLSERVER) and select ‘Properties’

    3. Click on the ‘Service’ tab

    4. For Start Mode, select ‘Automatic’, then Apply and OK

    5. Click on the Start button

    Reply
  • I have been trying to install the Sample Databases for SQL Server 2008 for days and can’t seem to find any relevant information!

    I don’t seem to have and .bak files anywhere? If they are not there how can I do a restore? Is there another way round this? Can I run the SQLScript in the database folder?

    Any help much appreciated! :)

    Reply
  • Ive have the same problem. There is no AdventureWorks.bak file? All other files are present. (it did ask me to debug 5 times during the .msi install.

    When trying option 1 instead of the restore option, i fail to find the @data_path in the instawdb file.

    A double block for me.

    What can i do?????? please help

    Reply
  • hey hello pinal sir…

    i m trying to install SQL srver 2008 since a log….
    but always got stucked at one point….

    actully it wants ACCOUNT NAME and PASSWORD for all analysys,reporting and fulltext filter FDHOST services…

    but i m not getting tht asking for which account name and password….

    can u assist me for tht…
    and suoopes i have no account created for thn is there any default account name and password can be used in place..
    please provide me the help…

    waitintg for response…
    is anyone else thn pinal sir have same que and have any solution thn request to help.

    Reply
  • Imran Mohammed
    April 1, 2009 6:30 am

    @Jigar,

    Why don’t you create a local account.

    start – (right click) My computer select Manage -Pop up will open – Expand Local Users and Groups – Right Click Users Click New User and provide some basic details and thats it, you will have a local user A/c.

    I have just seen screen shots for SQL Server 2008 installation, But in those screen shots I did not see any where it mentioning default built-in administrator account ( 2005, 2000). So I don’t think you have any other option but to create a local or domain user account and have it given appropriate privileges to run that service.

    Screen Shots Step by Step Installation of SQL Server 2008:
    Link :

    Regards
    ~IM

    Reply
  • sir i read your installation guide, i installed it correctly and i found no error but while using i found only system tables. while using method 1 i was unable to find @data_path and i tried for 2 method but i found back file in the folder can u hhelp me out

    Reply
  • I followed these steps in the link to install Sample database ino SQL server 2008. In Step 1. I can NOT find @data_path in instawdb.sql. Aslo when I when this script, I got
    Msg 102, Level 15, State 1, Line 26
    Incorrect syntax near ‘:’.
    but ” :on error exit” is correct syntax.

    Because Method 1 fails, I chooose Method 2. There is no *.bak file under /100 and its subdirectories.

    Please give some help. Thank you

    Reply
  • Mingle Linch
    June 5, 2009 12:58 am

    Samething here. I did not find @data_path variable. I downloaded v2008.x86.msi

    It also contains the following comments in the script –

    — Be sure to enable FILESTREAM before running this script!
    — Be sure to enable FULL TEXT SEARCH before running this script!

    –>> WARNING: THIS SCRIPT MUST BE RUN IN SQLCMD MODE INSIDE SQL SERVER MANAGEMENT STUDIO. <<–
    :on error exit

    /*
    * NOTE: These environtment variables are set by the installer package (MSI).
    * In order to run this script manually, either set the environment variables,
    * or uncomment the setvar statements and provide the necessary values if
    * the defaults are not correct for your installation.
    */
    –:setvar SqlSamplesDatabasePath "C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\"
    –:setvar SqlSamplesSourceDataPath "C:\Program Files\Microsoft SQL Server\100\Tools\Samples\"

    Reply
  • Mingle Linch
    June 5, 2009 2:09 am

    Sorry, it’s all set. The AdventureWorks database is already installed. It looks like I don’t need to do the rest of steps. Thanks.

    Reply
  • I did not have to do what this site sugests to get my samples database up and running. I downloaded the samples databases from the URL below

    https://archive.codeplex.com/?p=msftdbprodsamples#DownloadId=48051

    executed the msi, restarted sql service agent and a bunch of databases got attached to my sql 2008 instance

    AdventureWorks
    AdventureWorks2008
    AdventureWorksDW
    AdventureWorksDW2008
    AdventureWorksLT
    AdventureWorksLT2008

    ensure you download SQL2008.AdventureWorks_All_Databases.x86.msi

    I am running sql 2008 Microsoft SQL Server Enterprise Evaluation Edition in server 2003 STD

    Good luck!
    Bulolla

    Reply
  • Hi Pinal,

    I have installed sql server 2008 and found all the tables of AdventureWorks 2008 are present in the master database. The AdventureWorks sample db which I downloaded do not have any file with extension .Bak and also there is no “@data_path” variable present in the script.The screenshot present in the site is of the old script and I downloaded the updated one.So I request you to explain how to use this script and how to restore db using the updated AdventureWorks 2008 sample db.

    Thanks for your help in advance

    Reply
  • Hi.
    I have installed on my computer visual web developer 2008 express edition, but I when I deploy my web site on the remote server I cannot access my account or any other account. What should I do?
    regards

    Reply
  • Hi, I don’t see the back up file under C:\Program Files\Microsoft SQL Server\100\Tools\Samples\AdventureWorks OLTP,
    What should I do?

    Reply
  • Hi,
    I am using SQL Server 2008 – Developer Edition [Microsoft SQL Server code name “Katmai” (CTP) – 10.0.1300.13 (Intel X86) Feb 8 2008 00:06:52 Copyright (c) 1988-2007 Microsoft Corporation Developer Edition on Windows NT 6.0 (Build 6001: Service Pack 1) ]

    While installing I selected Fulltext Search feature, however when I open the Configuration Manager I do not see any FullText Search Services running.

    Thus I am not able to install the sample database using the .msi since it rolls back and asks me to enable Fulltext Search.

    I tried to re-install the complete SQL Server and again carefully chose FullText Search, still I do not see the Full Text Search service.

    Could anyone help me, how could I overcome this difficulty ?

    Also, the setup of this build does not show “Add New features to the existing instance”, thus I am not sure how we can add new features to this instance which were not installed at the first installation.

    Thanks,

    Nusrath

    Reply
  • Srinivas chandaka
    September 27, 2009 9:20 am

    HI,

    I hav downloaded the msi file and just instlled it.its created the Adventureworks databases automatcially and I did not followed any method.
    thanks a lot for the link.

    regards
    srini

    Reply
  • Mike Durthaler
    October 6, 2009 3:05 am

    Dave,

    This is a very good article, the key thing it did was get me to the correct download for 2008.

    However, this article and a few others fail to mention one thing: After installing SQL 2008 Express with Advanced Services or updating it to have Full Text Search, on a Windows XP workstation, don’t forget to go to the SQL Server Configuration Manager and start the service. :)

    The error will come up that Full Text Search is not installed when the AW DB .msi file is run if the service is not running.

    I found this when trying to figure out why the AWDB would not install. I knew the dialog saying Full Text Search was not installed wasn’t true: It should read when it IS installed “Please Start the Full Text Service”.

    In the process of also verifying that FileStream was enabled, I noted the service was not running. Indeed, during install I did note that the option was fixed at Manual at install time. I figured the .msi package would start it and indeed this probably was the idea.

    Anyhow, for anyone who needs the input who is also on an XP Workstation and does not have a separate box to run as a SQL Server … start the ruddy service as above and the AWDB will then successfully install.

    Reply
    • Nusrath,

      I initially had the same problem with developer. What I did was completely uninstall all editions of SQL (I had some Express versions in there I think). I even deleted any leftover folders after I uninstalled everything. Restart the computer. Once I did that, I created an account with just user privileges. I reinstalled SQL 2008 and made sure that for the full-text daemon login/password I put in my new user with limited privileges (this is during the installation process). I had no errors this time around and was able to install AdventureWorks successfully.

      Of course I probably did not need to uninstall everything, but I just wanted to make sure that I started with a clean slate. You could probably be able to do the same thing by simply creating a user with limited privileges and change the server settings from there.

      P.S I am using Windows XP Professional

      Diana

      Reply
  • The step Select local database instance is missing from your screen shot.

    I am stuck at that step. When I select SQLSERVER2008(Engine), the Next button still remains disabled.

    Reply
  • Hi Pinal,
    My issues are identical to Lalit except I have installed SQL Server Express 2008, which doesn’t have AdventureWorks 2008 present in the master database but no .bak file & no “@data_path”. I can’t believe how ridiculously hard it is to install sample DBs compared to 2005!

    Lalit
    Hi Pinal,

    I have installed sql server 2008 and found all the tables of AdventureWorks 2008 are present in the master database. The AdventureWorks sample db which I downloaded do not have any file with extension .Bak and also there is no “@data_path” variable present in the script.The screenshot present in the site is of the old script and I downloaded the updated one.So I request you to explain how to use this script and how to restore db using the updated AdventureWorks 2008 sample db.

    Thanks for your help in advance

    Reply

Leave a Reply