Search Wiki:
SQL Server Samples Portal Page > SQL Server Sample Databases

To download the sample databases click on the Releases tab or click here. Note that the default release is for SQL Server 2008. Select the SQL Server 2005 SP2a release before downloading if you are using SQL Server 2005 or the installation will fail.

Do you have questions or problems concerning CodePlex? See our FAQ.

Project Description

This project contains Database samples released with Microsoft SQL Server product.


Sample Databases

Microsoft SQL Server ships with several sample databases. You can find installers containing the sample databases on the Releases tab. You can find scripts which were used to build the databases on the Source Code tab along with Visio and JPEG versions of the schema diagrams.

Most sample databases and sample database business scenarios are documented on MSDN.

The following sample databases are currently available for Microsoft SQL Server 2005 and Microsoft SQL Server 2008:

  • The AdventureWorks OLTP database supports standard online transaction processing scenarios for a ficticious bicycle manufacturer (Adventure Works Cycles). Scenarios include Manufacturing, Sales, Purchasing, Product Management, Contact Management, and Human Resources.
  • The Adventure Works DW database demonstrates how to build a data warehouse.
  • The Adventure Works AS project can be used to build an AS database for business intelligence scenarios.
  • The Adventure Works LT database is a highly simplified and smaller sample database which is helpful for those who are new to relational database technology.

The Adventure Works LT Database is documented here.

You can view the schema diagrams without downloading them here.

There are a new family of AdventureWorks sample databases specifically designed for SQL Server 2008. More information about these sample databases are located on the Releases tab.

Please let us know in the developer forum for this project on the Discussions tab if you would like to contribute sample databases.

Last edited Feb 27 at 8:41 PM  by bonniefe, version 20
Comments
maximoguerrero wrote  May 8 2007 at 12:50 PM  
I actually like the LT version for showing sample on projects or demos i build. 2MB file make its very nice to redistribute especially after you zip it up. It also works great with SQL Express.

joyceschan wrote  Aug 8 2007 at 2:28 PM  
I'm getting 'error 1721 there is a problem with this windows installer package. A program requried for this install to complete could not be run...' Does anyone have any ideas what this is referring to?

patdev wrote  Aug 8 2007 at 8:49 PM  
how can i down load where is the link

snerk wrote  Aug 14 2007 at 5:22 PM  
How on earth do you download the samples?

trallan wrote  Aug 14 2007 at 9:02 PM  
Quote: -----
joyceschan wrote Aug 8 at 8:28 AM
I'm getting 'error 1721 there is a problem with this windows installer package. A program requried for this install to complete could not be run...' Does anyone have any ideas what this is referring to?
------
I'm getting the same error.

bonniefe wrote  Aug 17 2007 at 10:21 PM  
I've updated the page so that instructions for downloading the sample databases is now at the top of the page. If you are running on Vista, you need to either execute the msi from an elevated command prompt (Run as Administrator) or add your windows user account to the sysadmin role in the database. If you're not running in Vista and running into problems, please file an issue by clicking on the Issue Tracker tab on this page. Thanks!

BobbyC303 wrote  Aug 23 2007 at 2:33 PM  
Where are the 2005 versions? Everything I downloaded said 2008 on it and the MDFs won't attach.

jrreadel wrote  Aug 24 2007 at 4:26 AM  
AdventureWorksLT will not install Err: 27506. Sample DB is too new (2008) for the SQL Server Express that I downloaded & installed today. I need v612 or earlier unless there an upgrade to SQL Express that I am overlooking.

BobbyC303 wrote  Aug 27 2007 at 4:10 PM  
2005 releases are here
http://www.codeplex.com/MSFTDBProdSamples/Release/ProjectReleases.aspx?ReleaseId=4004

ColSchmoll wrote  Aug 29 2007 at 9:56 AM  
As you can see from some of the comments this site is not very intuitive. I’m looking to create an Adventure Works Analysis Services Database, which I assume I need to “The Adventure Works AS project can be used to build an AS database for business intelligence scenarios” quote from above. How do I achieve this?

ColSchmoll wrote  Aug 29 2007 at 9:57 AM  
Why are the most recent comments appearing at the bottom of the page?

ColSchmoll wrote  Aug 29 2007 at 10:08 AM  
Here is a link to MSDN where the Adventure Works AS database deployment is documented:
http://msdn2.microsoft.com/en-us/library/ms143804.aspx

sqlAndDotNet wrote  Sep 4 2007 at 9:20 PM  
2005 realeses ONLY !
I had to attach the Adventure Works dB manually after I ran AdventureWorksDB.msi. It works now.
Follow the steps on http://msdn2.microsoft.com/en-us/library/ms310325(VS.80).aspx
SQLCMD -S (local)\sqlexpress -E ......
.... exec sp_attach_db @dbname=N'AdventureWorks' ....


Nethinim wrote  Sep 23 2007 at 1:40 AM  
Running setup for AdverturworksDB.msi for SQL 2005 Express Edition on Windows XP may not put the sample database in a usable location. So watch where it installs ( in my case is was installed to C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\AdventureWorks_Data ) To get it to work I had to:
1 Open SQL Server Management Studio Express
2. Connect to a resigstered server (myComputerName\sqlExpress )
3. In the Object Explorer window, right click on the Databases folder and choose attach
4. In the Attach Databases popup window click the rectangular Add... button
5. Browse to C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\
6. Left click on the file named AdventureWorks_Data.mdf and click OK

Now when I open SQL Server Management Studio Express and connect to the \sqlExpress database I see in the AdventureWorks Database with five subfolders. I only found this workaround by going to "Change History (all pages) tab at the top of this page and reading through the old info. True detective what!? If it was easy, everyone would be doing it.

sportrx wrote  Sep 25 2007 at 10:01 PM  
database doesnt attach to sql05

goggcodeplex wrote  Oct 7 2007 at 1:39 AM  
Thanks BobbyC303, that version worked. The version brought to you here through Microsoft errors and doesn't install (it's about 31MB). Your version, which is about 28MB, did install. Thanks Nethinim, great instructions. I followed it, and now I have the AdventureWorks DB.

gmeytin wrote  Oct 9 2007 at 1:47 PM  
I’m new to SQL Server 2005 and Express Edition and your site was down yesterday.
I downloaded SQL Server 2005 Extress (sqlservr.exe – ver. 2005.90.3042.0).
I downloaded AdventureWorksDB.msi (31,707,648 bytes) from your site http://www.codeplex.com/MSFTDBProdSamples/Release/ProjectReleases.aspx?ReleaseId=5705.

I backed up and restore the Northwind database from SQL Server 2000 without any problem other than database diagrams were lost.

But when the time has come to attach the AdventureWorks database I’ve got the following messages from Microsoft SQL Server Management Studio Express:
Attached database failed for Server ‘myPC\SQLEXPRESS’, (Microsoft.SqlServer.Express.Smo)
Additional Information:
An exception occurred while execution a Transact-SQL statement or batch.
(Microsoft.SqlServer.Express.ConnectionInfo)
The database ‘AdventureWorks’ cannot be opened because it is version
631. The server supports version 612 and earler. A downgrade is not supported. Could not open new database ‘AdventureWorks’. CREATE DATABASE is aborted. (Microsoft SQL Server, Error: 948).

Any suggestions or help?

SeanDavis wrote  Oct 11 2007 at 3:51 PM  
I'm sorry but this site is an absolute nightmare to navigate. If you're going to host Microsoft Files, make the darn thing accessible and easy enough to find. After quiet a bit of time, its only through user complaints and the forum here that I was able to track down what I needed. Who knows if it will even work now.

ahammon wrote  Oct 11 2007 at 7:03 PM  
What happened to AdventureWorksDW? Is this now rolled up in the BI package?

ahammon wrote  Oct 11 2007 at 9:57 PM  
Ah, yes... I see that it is. That'll teach me for expecting things to be simple, obvious and clear. :)

joeyong wrote  Oct 13 2007 at 12:10 AM  
Downloaded the msi file and installed ok. Ran the instawdb.sql script and it failed on the data loading section. Modified the line that sets the path for the samples directory to
SET @data_path = 'C:\Program Files\Microsoft SQL Server\100\Tools\Samples\AdventureWorks OLTP\';
and it runs fine. Seems like the instawdb.sql script is an old one as it points to the data folder for loading the csv files. Hope someone has time to make the tiny fix.

rkl3011 wrote  Oct 18 2007 at 9:09 PM  
Finally the right place to look for sample databases.

nollkoll wrote  Oct 19 2007 at 8:34 AM  
after downloading and installing .msi for AW and AW DW samples I can not find any folder under my SQL2005 folder containing any Notification Service samples. Anyone know where they go or in what download sample file they are ..? According to BOL Notification Service tutorial there should be 6 different samples to look at...

Margaret wrote  Nov 9 2007 at 2:41 PM  
Hi, I´m having the same trouble that trallan wrote & joyceschan wrote 'error 1721 there is a problem with this windows installer package´ I have enclosed their quotes below.

My operating system is Windows XP home edition.

Can you please help, as I don´t appear to be able to find the answer that you gave to trallan & joyceschan ??

THEY WROTE:-
trallan wrote Aug 14 at 11:02 PM
Quote: -----
joyceschan wrote Aug 8 at 8:28 AM
I'm getting 'error 1721 there is a problem with this windows installer package. A program requried for this install to complete could not be run...' Does anyone have any ideas what this is referring to?
------
I'm getting the same error.

ShapiroW wrote  Nov 12 2007 at 1:01 AM  
My deepest thanks to nethinim. Because of your comment I was able to get the AdventureWorks DB working. You saved me a lot of aggravation.

bonniefe wrote  Nov 16 2007 at 8:54 PM  
nolkoll, you need to download the SQL Server 2005 samples MSI to get Notification Services samples since Notification Services samples were removed from SQL Server 2008. You can find SQL Server 2005 sample installers at http://www.codeplex.com/SqlServerSamples/Release/ProjectReleases.aspx?ReleaseId=4000.

bonniefe wrote  Nov 16 2007 at 8:54 PM  
For the folks with 1721 errors, can you check and see if you already have AdventureWorks installed and attached? If so, you need to drop and delete the old database before the new one can be installed.

Daffy_Duck wrote  Nov 29 2007 at 2:45 PM  
i need to download it from where?

bonniefe wrote  Dec 4 2007 at 1:22 AM  
You can download the SQL Server 2008 November 2007 CTP database installers from http://www.codeplex.com/MSFTDBProdSamples/Release/ProjectReleases.aspx?ReleaseId=8392, and the SQL Server 2005 SP2 installers from http://www.codeplex.com/MSFTDBProdSamples/Release/ProjectReleases.aspx?ReleaseId=4004. Information about how to use CodePlex to download samples is located at http://www.codeplex.com/SqlServerSamples/Wiki/View.aspx?title=HowToUseCodePlex&referringTitle=Home.

dalepres wrote  Dec 12 2007 at 9:08 PM  
I think that it is totally unacceptable for Microsoft to offload officially supported products, such as the sample databases necessary to work with and understand the samples in BOL, to what they refer to as a third-party site, such as codeplex. The availability of CodePlex is terrible. Virtually every time I try to access the site for something I need now, the site is crashed and it takes a lot of time and submitting issues with Microsoft Support before the site becomes available again. Please quit putting things that are not in the context of codeplex on the codeplex site. CodePlex is, by definition, a place for community supported projects. BOL, and thus sample databases, are officially supported features and do not belong here.

rds622 wrote  Dec 14 2007 at 4:11 AM  
Does anyone else get these errors:
Msg 1813, Level 16, State 2, Line 1
Could not open new database 'AdventureWorks'. CREATE DATABASE is aborted.
Msg 602, Level 21, State 50, Line 1
Could not find row in sysindexes for database ID 12, object ID 1, index ID 1. Run DBCC CHECKTABLE on sysindexes.

Looks like the mdf file is corrupted, but even after reinstalling AdventureWorksDB I still get the same errors. I have SQL Server 2005 Management Studio.

gaile_ms wrote  Jan 16 at 6:44 PM  
Hi rds622,
You may have SQL Server 2005 Management Studio, but are you connecting to an instance of SQL Server 2005 or SQL Server 2000? These errors typically indicate that you're trying to install AdventureWorks on an instance of SQL Server 2000. You can verify the version of SQL Server you're connecting to in SSMS by running select @@version.

JJ60764 wrote  Jan 23 at 7:10 PM  
gaile_ms - I have the same problem as rds622. I have an instance of 2000 installed on my machine. When I connect, the version that connects in the 2005 interface is 8.0 (2000). How do I remedy so I can get adventureworks to attach? Thanks!

dblack wrote  Jan 24 at 8:09 PM  
The Northwind Database is no longer included in the SQL Server 2005 & 2008 Samples. You recommend to use the AdventureWorks Database instead.

However, the vast majority of Labs, sample applications, sample projects, etc. use the Northwind Database. This is true even for some of the samples, webcasts, etc. for .NET 3.5 (ASP.NET Dynamic Data, etc.).

Considering that it is far more work to update all of the Sample Apps, Projects, Labs, etc. rather than the inclusion of the Northwind Database, it reasons that the obvious solution is to include Northwind. Though you can download the Northwind version for SQL 2000, there are some manual changes that need to be made to the database to get it to completely work under SQL 2005 & SQL 2008.

Please include the Northwind Database with SQL 2005 & SQL 2008 along with the changes necessary to get it to fully work with those later versions of SQL.

rajeev wrote  Jan 29 at 9:50 AM  
tu stands for thank you.

gaile_ms wrote  Feb 11 at 6:14 PM  
To JJ60764,
It sounds like the default instance on your machine is the SQL Server 2000 instance and the 2005 instance is a named instance. When you are prompted to connect in SQL Server Management Studio, you need to enter the named instance in the connection box. For information about to find the name of the instance, see this Books Online topic http://msdn2.microsoft.com/en-us/library/ms345295.aspx

eralper wrote  Feb 25 at 8:01 AM  
Hello all who has getting the Error 1721 informing about a problem with this Windows Installer Package and pointing the action where the exception occurs: InstallDatabase, location '...\AdventureWorks_Log.ldf' FOR ATTACH

I think, I got this error message since I'm not using the default installation paths, "C:\Program Files\Microsoft SQL Server\100\Tools\Samples"
Instead I chosed C:\Program Files\Microsoft SQL Server CTP6\100\Tools\Samples for installation path for SQL Server CTP6 and also for the samples.

The solution which worked for my case is just opening the SQL Server Management Studio and select the ATTACH context menu item on the Databases node and attaching the .mdf file from where it resides after the failed installer action.

monicajellybean wrote  Mar 8 at 8:45 AM  
To Nethinim
You rock! I had been trying to figure how to add the Adventure Works database and your instructions helped me to do what I had been trying to accomplish for hours. I had already added two other databases, but all I did was simply attach pre-written queries. The Adventures Works was a lot different.

longshanks wrote  Mar 31 at 2:48 PM  
Hi dudes, Just wondered if anyone had noticed that SQL Server 2005 is the most moribund tableau they have ever encountered?

mrjimmy wrote  Apr 1 at 10:46 PM  
Please, GIVE US THE NORTHWIND DATABASE!
In addition to all the samples and tutorials that Microsoft provides, all the .net related books I've seen use Northwind. I've yet see ANY book use Adventureworks.

corrosione wrote  May 1 at 1:17 PM  
Intresting, well every book I have seen (In the past 3 years uses adventureworks...though that would be book written after 2005-6. I would suggest Beginning SQL or testout. As far as installing the Adventureworks x64.msi, I had to restore it once I installed it. Right click Databse in the object tree and choose 'restore database,' Choose 'From Device,' under, "Specify the source location of backup sets to restore," Choose 'ADD,' Then navigate to 'C:\Program Files\Microsoft SQL Server\100\Tools\Samples' and choose the adventureworks you installed. Click OK, Click OK, under the "Select or type the name of a new or existing database for your restore operation," Choose 'Adventureworks2008' from the drop down. Also, under the "Select the backup sets to restore." put a check in 'Adventureworks2008-full database backup,' (yours may read a little different) Now click ok. That should do it. If not please post back I would like to help any I can.