How to Install Sample Databases in SQL Server 2008 Express

Install Sample Databases

The databases, such Northwind and Pubs, are sample databases which are used for testing and developing on SQL Server. They are widely used in many sample source code and referenced by many tutorials. So if you are a developer or want to learn about SQL on SQL Server, these databases are needed to be installed on your development PC.

This article shows how to install Northwind and Pubs databases on Microsoft SQL Server 2008 Express.

Step-by-step to install sample databases

  1. Browse to SQL Server 2000 Sample Databases and click on SQL2000.Sample.Databases.(Northwind,pubs).zip to download the Northwind and Pubs databases. Once you clicked the file, there will be a pop-up displays license of this file. Click I Agree to download the file.
    Note: This file contains sample databases that can be used on SQL Server 2000/2005/2008.
    Download SQL Server 2000 Sample Databases
  2. Extract the zipped file, you will see files as the figure below. There are two methods to install these sample databases on SQL Server. The first method, run query on the SQL Server using instnwnd.sql and instpubs.sql for Northwind and Pubs databases respectively. The second method, attach database on SQL Server using NORTHWND.LDF and NORTHWND.MDF for Northwind database and PUBS.MDF and PUBS_LOG.MDF for Pubs database. On this article, I will show how to install Northwind and Pubs databases using the second method.
    Sample Database Files
  3. Open Microsoft SQL Server Management Studio and connect to your SQL Server.
    Connect to SQL Server
  4. Once the connection has been established, right-click on Databases and select Attach.
    Attach Databases
  5. On Attach Databases, click Add in Databases to attach section.
    Add Databases to Attach
  6. On Locate Database File, browse to the folder where you extracted the downloaded file in step 2. Select a database file that you want to attach. I select NORTHWND.MDF which refers to Northwind database and click OK.
    Locate Database File
  7. You will see detail of Northwind database. The NORTHWND.LDF is automatically added in the details on section below (“Northwind” database details).
    Install Sample Databases - Select Northwind database to attach
  8. Repeat step 5 and 6 for Pubs database by attach PUBS.MDF file if you want to attach more than one database at the time. After you finish selecting databases that you want to attach, click OK.
    Install Sample Databases - Select Pubs database to attach
  9. If there is no error, you will see the sample databases (Northwind and Pubs) list on the SQL Server as the figure below. Now you can use these sample databases as you want.
    Attached Sample Database

One Response

  1. bhawesh June 25, 2014

Leave a Reply