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
If you have installed SQL Server as default instance run following command.
c:\>sqlcmd -i instpubs.sql
c:\>sqlcmd -i instnwnd.sql
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.
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.
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
191 Comments. Leave new
Once again – The right answer and the whole answer. Thanks so much
Thank you so much :) :) :)
thanks a lot man i was having problem in attaching these DB’s … THANKS ALOT
Hi
Thanks a lot buddy..It worked for me..keep the good work up
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.
Great, worked as stated – very easy and quite handy! Thanks.
Thanks ! That really helped ! Good Luck dude !
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.
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.
Thanks a lot Dave … It really helped me to install Pubs and Northwind
Thank you very much Dave. tht was simple and very useful.
Thank you very much pinaldave, the post was very helpful to me :)
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)
I get the same problem as Divya
Great job!
Thanks for your information. Its very helpful for me.
Muchas Gracias, por su aporte…. Excelente
Juancaleon
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
Thanks a lot for this page, it was pretty helpful.
Regards from Monterrey Mexico.
Thanks Pinal!