Wednesday, December 17, 2008

Northwind Database with SQL Server 2008

I have been using TestNorthwind, a copy of the Northwind database that got shipped with SQL Server 2000 in many of my articles and my book. Some of my readers have asked me how to get this database.

With each new version of SQL Server Microsoft has been providing new sample databases such as pubs, Northwind, Adventure Works etc. In recent versions Microsoft does not provide a sample database during installation of the server but provides a link to download the sample database. A variety of methods can be used to install the databases. Two most common ones being; running the SQL script files or, using the attach/detach methods.

The sample databases PUBS and NORTHWIND can be downloaded from this link:

This .msi file installs both Northwind and Pubs database MDF/LDF files as well as instwnd.sql and instpubs.sql files. Make sure you read the ReadMe files.

The Important steps for attaching the Northwind database are shown here.

Step 1: Run the installer program. This is just one screen from the installation.

The files are installed to C:\SQL Server 2000 Sample Databases

Step 2: Connect to SQL Server 2008 and start the Attach wizard

Connect tot SQL Server 2008 and expand the nodes. Right click Databases folder and choose Attach...
The Attach Databases window gets displayed as shown.

Step 3: Click on Add...button. Browse to the C:\drive and click on the NORTHWND.mdf. You can provide a different name using the AttachAs option.

Step 4: Click on the OK button. Northwind database can now be found in the Databases folder. The owner will be the account name of the machine owner in this Windows XP Installation.

Which database to use and where?
This largely depends on the purpose the database will be used. I have used Northwind many times as it is sufficient to demonstrate most aspects of relational databases. I have used it in the past as a backend database for demonstrating Analysis Services, Reporting Services and Integration Services demos. Adventure Works is another excellent sample database well suited for OLTP and OLAP demos. Actually I keep all of them on my servers for testing.

1 comment:

deepak thakare said...

Thanks Sirji.. You are ausom..:) Protection Status