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)