SQL SERVER – 2005 NorthWind Database or AdventureWorks Database – Samples Databases – Part 2

I have mentioned the history of NorthWind, Pubs and AdventureWorks in my previous post SQL SERVER – 2005 NorthWind Database or AdventureWorks Database – Samples Databases. I have been receiving very frequent request for NorthWind Database for SQL Server 2005 and installation method.

Follow the steps carefully and it will install Northwind and Pubs database in SQL Server without any issue. I have tested all the three methods on my home computer and attached the screen shots as well.

Common Step for all the 3 methods

First, go to Microsoft Download Center and download SQL2000SampleDb.msi.
Run SQL2000SampleDb.msi it will create “C:\SQL Server 2000 Sample Databases” folder.
Now follow any of the following three methods to install this database. I have listed methods in order of my preference.

Method 1: Running SQLCMD
Navigate to this folder using command prompt. Start >> Run >> C:\SQL Server 2000 Sample Databases.
If you have installed SQL Server as named instance run following command.

c:\>sqlcmd -S .\InstanceName -i instpubs.sql
c:\>sqlcmd -S .\InstanceName -i instnwnd.sql

SQL SERVER - 2005 NorthWind Database or AdventureWorks Database - Samples Databases - Part 2 sqlservernw1

If you have installed SQL Server as default instance run following command.

c:\>sqlcmd -i instpubs.sql
c:\>sqlcmd -i instnwnd.sql

SQL SERVER - 2005 NorthWind Database or AdventureWorks Database - Samples Databases - Part 2 sqlservernw2

Verify that NorthWind and Pubs database are installed correctly.
Method 2: Running SQL Script
Open SQL Server Management Studio. Go to File >> Open >> Navigate to “C:\SQL Server 2000 Sample Databases\instpubs.sql” and “C:\SQL Server 2000 Sample Databases\instnwnd.sql” and run those SQL files in order. This will install the database.

SQL SERVER - 2005 NorthWind Database or AdventureWorks Database - Samples Databases - Part 2 sqlservernw3

Method3: Attaching the Database
Move Northwind and Pubs database files (MDF and LDF files) to your default database file location (usually – C:\Program Files\Microsoft SQL Server\MSSQL\Data).
Open SQL Server Management Studio. Expand the database node >> Right click on Databases >> Click on Attach >> Select NorthWind Database. It will automatically find MDF and LDF file. Click OK.

SQL SERVER - 2005 NorthWind Database or AdventureWorks Database - Samples Databases - Part 2 sqlservernw4

Repeat the process for Pubs and verify that databases are installed correctly.

Reference: Pinal Dave (https://blog.sqlauthority.com), Read-Me file in the installation folder, BOL

SQL Download, SQL Sample Database, SQL Scripts, SQL Server
Previous Post
SQL SERVER – Easy Sequence of SELECT FROM JOIN WHERE GROUP BY HAVING ORDER BY
Next Post
SQL SERVER – sp_HelpText for sp_HelpText – Puzzle

Related Posts

191 Comments. Leave new

  • Once again – The right answer and the whole answer. Thanks so much

    Reply
  • Thank you so much :) :) :)

    Reply
  • thanks a lot man i was having problem in attaching these DB’s … THANKS ALOT

    Reply
  • Hi

    Thanks a lot buddy..It worked for me..keep the good work up

    Reply
  • This is the best explanation one could ever give..thanks a lot..
    but in the first method i am getting this error..thought i was able to run second method.can u tel me solution for this..

    HResult 0xFFFFFFFF, Level 16, State 1
    SQL Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF].
    Sqlcmd: Error: Microsoft SQL Native Client : An error has occurred while establi
    shing a connection to the server. When connecting to SQL Server 2005, this failu
    re may be caused by the fact that under the default settings SQL Server does not
    allow remote connections..
    Sqlcmd: Error: Microsoft SQL Native Client : Login timeout expired.

    Reply
  • Great, worked as stated – very easy and quite handy! Thanks.

    Reply
  • Thanks ! That really helped ! Good Luck dude !

    Reply
  • ur extremely superb.. I saved lot of my .. time to day.. thanks.. guys if ur missing the sql authority .. ur definitely missing a good one..

    goodluck.

    Reply
  • hi,

    I was trying to install advntureswork .LT from this link

    “http://www.codeplex.com/MSFTDBProdSamples/Release/ProjectReleases.aspx?ReleaseId=4004”
    from which i have installed advwrks.DW and advwrks.BI which worked really well but when I was trying 4r .LT it was installed but it says “read only ”

    can i know how to install it perfectly.please help me.

    Reply
  • Thanks a lot Dave … It really helped me to install Pubs and Northwind

    Reply
  • uday kumar lazurus
    June 9, 2009 12:07 pm

    Thank you very much Dave. tht was simple and very useful.

    Reply
  • Mohammed A. Fadil
    June 20, 2009 5:06 pm

    Thank you very much pinaldave, the post was very helpful to me :)

    Reply
  • Hi Dave

    I get this error when I try attaching the db.
    Please Suggest.

    Attach database failed for Server ‘DIVZ-PC\SQLEXPRESS’. (Microsoft.SqlServer.Smo)

    An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

    ——————————

    Database ‘pubs’ cannot be upgraded because it is read-only or has read-only files. Make the database or files writeable, and rerun recovery. (Microsoft SQL Server, Error: 3415)

    Reply
  • I get the same problem as Divya

    Reply
  • Great job!

    Reply
  • Thanks for your information. Its very helpful for me.

    Reply
  • Muchas Gracias, por su aporte…. Excelente

    Juancaleon

    Reply
  • Naveen Narayan
    August 14, 2009 12:07 pm

    Not able to see the files in Sql Studio Tree

    C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data

    Is this because of user privilage issue.

    Naveen

    Reply
  • Thanks a lot for this page, it was pretty helpful.

    Regards from Monterrey Mexico.

    Reply
  • Thanks Pinal!

    Reply

Leave a Reply