Monday, May 14, 2012

How to install SQL Server 2008R2 Sample Database

You want to learn Microsoft SQL Server. You are wondering which books to buy from Amazon.com. Well, you don't have to. It is always a good practice to follow the official tutorial from MSDN.

This article is to illustrate how to get started with MSDN SQL Server 2008R2 Tutorial. The URL is: http://msdn.microsoft.com/en-us/library/ms167593(v=sql.105).aspx

Basically, you need a whole package of MS SQL Server 2008R2 installed in your local machine, of course. The other thing you need is the sample database, so that you can follow step by step what Microsoft wants to teach you.

However, the installation of the sample database AdventureWorks2008R2 confused me a lot. I just figured it out and want to my experience with you so you don't have to spend so much time, like me.

The download page is here: http://msftdbprodsamples.codeplex.com/releases/view/55926 However, you can see there is no download link associate with it. This is because Microsoft found bugs in the previous sample database windows installer. However, Microsoft provides another way to install AdventureWorks2008R2 in here: http://msftdbprodsamples.codeplex.com/releases/view/59211

So, here are the steps:
1. download the AdventureWorks2008R2 Data File from http://msftdbprodsamples.codeplex.com/releases/view/59211 . Download it anywhere on your local machine, first. You will get the "AdventureWorks2008R2_Data.mdf" file.



2. Move the "AdventureWorks2008R2_Data.mdf" file into your local SQL Server in "C:\Program Files\Microsoft SQL Server\MSSQL10_50.SSZIYIN\MSSQL\DATA". My local instance is named "SSZIYIN", it may differ in your local machine.



3. Go to SQL Server Management Studio and connect to your local server, mine is SSZIYIN.



4. Unfold the database tab and right click database tab, select "attach"



5. Click "Add" and then navigate to the directory "C:\Program Files\Microsoft SQL Server\MSSQL10_50.SSZIYIN\MSSQL\DATA" and select "AdventureWorks2008R2_Data.mdf"




6. In the detail window below, remove log file. You done!



Now you have the sample database AdventureWorks2008R2. So, what are you waiting for? Start your adventure with SQL Server 2008R2!!

Note:
The sample database installation tutorial is here: http://social.technet.microsoft.com/wiki/contents/articles/3735.sql-server-samples-readme-en-us.aspx#Readme_for_Adventure_Works_Sample_Databases , which is not clear for me...so I created this article. Enjoy!

1 comment:

  1. Thank you, easy and well explained. Just an observation, when you're adding the DB, sometimes ask for a "Log" you must remove to add it without problem.

    ReplyDelete