Just a day ago I received question from reader who just installed SQL Server 2008. After installation user did not find any samples database along with installation. User want to install samples database which he is very much used to.
Sample database are now moved to Microsoft’s opensource site of Codeplex. Visit following link to visit the Sample Database page.
CodePlex SQL Server Sample Database

There are two different method to setup sample database. 1) Running SQL Script 2) Restoring Database Backup. There are few common steps in both the process. We will see the common process first and then after see both the method to setup sample database in detail.
Common Steps:
Download the .msi package from codeplex based on your operating system and your SQL Server version. I have used Adventureworks DB version of 2005 as that is what was question 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 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 script is successfully ran, following resultset 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 right options when restoring database.




Location of Database backup is where sample database are extracted “C:\Program Files\Microsoft SQL Server\100\Tools\Samples\AdventureWorks OLTP“.



Following screen is most important, make sure to select options displayed in the screen or database will not be restored.



Check AdventureWorks database in object explorer.

If you want to install AdventureWorks database version 2008, the methods works fine. There are additional sample database are available in the same package and they can be installed in 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 sample database with SQL Server 2008. Additionally, let me know what you think about this in depth explanation of process of setting up sample database.
Reference : Pinal Dave (http://www.SQLAuthority.com)






hi, andar here, i just read your post. i like very much. agree to you, sir.
Very nice
luckyregister is hosting my web site and i have a new web pages getting uploaded this week with forms to collect names emails squeeze pages they are for real estate so the luckyregister.com gives me choices of DATABASES: ACCESS, MYSQL, and SQLSERVER. BUT I DONT know how in the world it works or how to setup anything in the sql server. stuff. like i dont know how to tie the commands queries schemas to work. i dont eve n know what ot ask you thats how confused i am about this when i looked at the databse and what it has in its admin area.. is it easyy to setup but just dont have the directions what do i do if you were me.?????????
Mike
This worked perfectly, even for a novice ;)
Thanks!
J
One thing to add to the docs is that filestreaming needs to be enabled. I’m an oracle person, so not everything is intuitive, and I felt like an idiot for not being able to get the samples installed. So your site was a wonderful resource and the only set of instructions that got me through this (I followed option 2) Thanks much! lc
Thank you for this.
I was so annoyed at the SQL server samples install. It was so stupid. Sometimes I wish there would be a message saying :
“WARNING : Installing the sample databases look easy, but is actually quite difficult. Do not expect a simple wizard. Even though it looks like you are just going to press intall on the MSI package, you actually have to build the database from TSQL an change programming code to match your setting after this wizard has installed the files. Also, this wizard will not help you at all trying to figure out what kind of files you should open or at all how to make sense of this install. The documentation is able to help you, but it is structured in such a way that 90% is irrelevant and it is almost impossible to discern wether what you will be reading is relevant. Do expect loss of hair during this install.”
one things left if i see your pic SQL2008.AdventureWorks_All_DB_Scripts.x86.msi has 80495K but i downloaded it n it has SQL2008.AdventureWorks_OLTP_DB_v2008.x64.msi
source code, 44740K, uploaded Aug 7 - 1240 downloads
getting more confuse…did i miss something?!?
Thanks a lot.
Absolute newby on SQL SERVER and the sample db’s are a nightmare to install when just statring out.
Spent hours trying to work out what I was doing wrong, I did manage to get the blank db’s install then spent ages trying to figure out why empty.
Eventually found a post with a link to this, should really make it a “sticky” on codeplex forum. Luckily I was balding before I started to try and install.
On a serious note for any newby’s something which should be so simple, quick and easy has seemingly been made very complex, hard and long when a guide similar to this is all thats needed.
Many Thanks !!!
Your site is at the top of the list of my “Favorites”. This is the go to place for solutions.
I followed Method 2 to restore database back up,I did the same procedure but I’m getting following error at the end of final step,
System.Data.SqlClient.SqlError:The path that is specified by
C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\AdventureWorks.Documents’ cannot be used for FILESTREAM files bacause it is not on a supported system.(Microsoft.SqlServer.Smo)
What could be the reason?
I am using sql express and I don’t have the server management studio. I can’t seem to get sqlcmd to work because it can’t find the dql script even though sqlcmd and the script are in the same directory.
Any suggestions would be welcome.
Roger
I am using 2008/Express. A little different from your screenshots, but close enough I could figure this out.
Like many others because it was an MSI I wasn’t expecting to do anything once it finished.
The biggest clue was to click start.
hello,
when I try to install the setup I get this error message
PrepInstance() failed for MSSQL$SQLSERVER2008. the following features are missing: Full Text Search fix the problems and re-run setup
please tell me how to fix it.
thanks
Works like a charm for SQL Server 2008!
[...] For installation instructions please refer my previous article here. [...]
Hi Pinal,
When I am trying to install sample database got error “full text search feature missing” Install first that and installation
didn’t complete (Roll back)
Please let me know what to do
Regards
I have the same problem.. Did you get an answer?
Regards,
MC
I also have the same problem. Full Text Search is installed.
Best Regards,
Salil.
Hi,
The Full Text Search service was stopped , I had to enable it from the
Sql Server Configuration Manager -> Sql Server Services -> Sql Full Text Filter Deamon Launcher ( MSSQLSERVER ).
I installed SQL2008.AdventureWorks_All_Databases.x86.msi and it worked for me.
Best Regards,
Salil.