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.
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“.
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.
Once the script is successfully running, following result set will be returned.
Check AdventureWorks database in object explorer.
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.
Location of Database backup is where sample database is extracted “C:\Program Files\Microsoft SQL Server\100\Tools\Samples\AdventureWorks OLTP“.
The following screen is most important, make sure to select options displayed in the screen or database will not be restored.
Check AdventureWorks database in the object explorer.
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)
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
Thanks Pinal..
plz sent to me sql server 2008 r2 full source plz
sql server data base
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
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
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
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…
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
Thank you sir.
We love you …
bye bye
CodePlex SQL Server Sample Database
link is not working….
I want adventurework database for readin 70-433.
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???
Hi PinalSir,
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
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.
Please update with new version
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.
hi mr pinalsir,
thank you, your article is very helpful. :)
Really This is very nice step by step learning .
thank you.
hi i am kanji
how to download SQL Server managemant studio
and how to instolation to pc