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 method 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 method to install this databases. 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 file in order. This will install the database.

Verify that NorthWind and Pubs database are installed correctly.
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 NorthWind and Pubs database are installed correctly.
Reference : Pinal Dave (http://blog.SQLAuthority.com) , Read-Me file in installation folder, BOL




Hey, kudos on this information. I was able to install both pubs and northwind in minutes :)
U r the best teacher. U made the installation of both Northwind and Pubs so easy. Thanks.
Good information. Thanks.
Jo Buddy,
This is good article, just wondering if you can elaborate why there is not change when you copy mdf, ldf file of MS 2000 in MS 2005 there is not effect.
This site has been a great help to me.
Good work… Keep it up!!!
yahooo…i could successfullly install Northwind and Pubs
I enjoy writing this post.
Glad to know that this is helping.
Kind Regards,
Pinal Dave (http://www.SQLAuthority.com)
Dear Pinal Dave,
I have purchased “The Guru’s Guide to Transact – SQL” by Ken Henderson at the advice of my supervisor. Ken recommended installation of the two databases, so I found your site on the net. The installation was easy and the two new databases appeared in the Object Explorer window of my Microsoft SQL Server Management Studio. However, when I tried to open each of the databases, I got a message box as follows:
“The database Northwind is not accessible”
“The database pubs is not accessible”
Perhaps you can reply with explanation of how I should gain access to these two new databases. I offer my thanks in advance to your reply, and certainly appreciated your help with the installation.
Sincerely,
Doug Thornton
Systems Integration Programmer
Pinal Dave,
I answered my own question, as I just had to authenticate via Windows instead of SQLServer when logging in using Management Studio. Access to databases complete !!!
Doug Thornton 082307
@Doug,
You can use SA username and password to login.
You can create username and give permission to access those database.
Regards,
Pinal Dave ( http://www.SQLAuthority.com )
How do I Verify that NorthWind and Pubs database are installed correctly at the end?
I can load both databases and then I seem to be stuck on what to do next.
I am using method 2.
Also is this safe to do as I am connected to my workplace master database and do not want to affect anything in there.
Thanks Pinal
Jatinder
Hi Jatinder,
Open the database and run select statement on any table. It should help.
Regards,
Pinal Dave ( http://www.SQLAuthority.com )
I cant seem to select statement. This is first time I’ve used SQL, hence why i’m not grasping it as easy as other people.
Can you show me please? tks
I do not have a C: drive. How in the world can I extract the files I need from the .msi?
Thanks.
Hi
I have the same problem… I don`t have a C: drive. What can I do?
Regards, Mircea
Thanks for the info was able to install northwind w/o any trouble
Once the Northwind database is installed, how do I go about getting/setting the admin username and password as well as other usernames and passwords?
Thanks
Jason
Thanks SO much – works VERY well- JC bless you!
Excellent help. It was easy and fast.
And by the way, the first method is the best.
thankx very much. got my solution in the first try! :)
Hi ,
i am getting the follwing error when i tried to attach Adventure Works Database.
——————————
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
——————————
Could not find row in sysindexes for database ID 9, object ID 1, index ID 1. Run DBCC CHECKTABLE on sysindexes.
Could not open new database ‘AdventureWorks’. CREATE DATABASE is aborted. (Microsoft SQL Server, Error: 602)
——————————
Please Help.
Thanks In Advance
Hello Pinal,
I am beginner of sql server 2005 and to the stored procedure.
I have created simple stored proc.
but it gives me error like
“The specified schema name “hr” either does not exist or you do not have permission to use it.”
i hv given the sp name hr.try
database is Nirmal
and table name is unamepass.
I am waiting for your response
Thank you very much
Nirmal Shah
Hello Yuva,
this error message appears when you try to attach a Microsoft SQL Server 2005 database in SQL Server 2000.
This behaviour occurs because attaching SQL Server 2005 databases in SQL Server 2000 is not supported. Upgrade your database server to SQL Server 2005.
hi,
i was struggling to work this out..but ur diagramatic approach has fixed it..
good work!!!
I was looking all over for a SQL Server 2005 version of the Northwind database and couldn’t find it anywhere… thanks very much for your help!
Hi I too have a problem similar to that posted by YUVA.
Getting the similar error as follows :
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
——————————
Could not find row in sysindexes for database ID 9, object ID 1, index ID 1. Run DBCC CHECKTABLE on sysindexes.
Could not open new database ‘AdventureWorks’. CREATE DATABASE is aborted. (Microsoft SQL Server, Error: 602)
And I do see sql 2000 files on my system.
However I installed Sql server 2005 and am not able to attach adventureworks database into it.
I dont know how to Upgrade my database server to SQL Server 2005.
No option is available to remove sql 2000 from my system in add/remove programs.
I would appreciate if anyone would be able to get me out from this problem.
Thanks in advance.
Didn’t see this mentioned — in Vista, if you’re executing sqlcmd from the command prompt, run cmd.exe as Administrator… otherwise the script will puke all over the place with ‘permission denied’ and ‘does not exist’ errors.
Yes I got what I needed
thankx very much. GOD BLESS U
Very help full site. clean site with not much noise of ads and disctractions.
But have a question though? Why email is necessary to post feed back.
Thank you so much for your commitment in providing this essential info…so many tutorials (ex. the ASP.NET 2.0 material I’m working with currently) is requiring the NWind db (and many legacy materials reference the Pubs db, of course), and to have such a clear resource to work with makes it a reality…and also reviewing the import scripts that create the db is a valuable exercise as well. CHEERS!
Thank you very much…..it is really helpful
Thanks Dave!!
Keep it Up.
Thanks man … !!!
Great job …
Hello,
Can anyone specify how can I find sample cude from Sql Server 2005?
Thanks and regards
George
thanks, that is really what i want.
Nice and user friendly. Thank you.
Very well done, Pinal. Wonderful job :-) This site is really very helpful.
Good article- not just the “what” but also the “why”.
Unfortunately trying to install the database files for use with Visual studio 2003 and sql server 2005 is a minefield and he has done his best to find a path through it.
Excellent article – Most useful.
I downloaded SQL2000SampleDb.msi and now I have SQL Server 2000 Sample Databases in my C drive. Then I tried executing this command in the command prompt
c:\>sqlcmd -S .\InstanceName -i instpubs.sql
c:\>sqlcmd -S .\InstanceName -i instnwnd.sql
but I got this error,
’sqlcmd’ is not recognized as an internal or external command, operable program or batch file.
the I tried the other set of command too
c:\>sqlcmd -i instpubs.sql
c:\>sqlcmd -i instnwnd.sql
again I got the same error.. cannot figure out why. Please help me
Thanks
hey Pinal,
Thanks for this post..just the thing I was looking out for.
Give me a call anytime you land up in Ahmedabad, would be great to meet you…not that I’m a big techie..but i undestand whats going on :)
regards
Harish
thanks! great help.
For all those who are using Vista – you should start cmd with administrator privileges.
Go to C:\windows\system32\cmd.exe right clik and click “Run as Administrator”. Than firs option for installation threw command prompt will work just fine.
great post. I successfully installed Northwind.
thanks,
gaurav
Thanks man. Good help
I have developed an application in Visual C#.net 2005 it is connected to a Sql Server database at back end.Now i want to create a setup project which should first install my application as well as Sql server. i.e when i install my application it also installs Sql Server if it is not already installed.
How can i do this?
I will be very thankful.
Thanks!
phew .. finally
many thanx
Yay…
Thanks..
You rocks…!
thnx a bunch for this man.. very helpful, db sample install made simple ;-)
hi can an bod tell me how to set database on server when creating setup in .net .
Thanks, I have succesffully instaled Northwind.
I am not able to download “SQL2000SampleDb.msi” from Microsoft url becuase of some security issues is there any other place where i can download it from
Thanks
I am a newbie to sql server….
i found this information v v v v useful to install these databses…
thank you…
It really works. Thank U!
Cheers!
This is an excellent stuff.
I’m learning SQL Server 2005 and ASP .NET, please help me to find any site which explains in such a simple English to learn, I’ll be glad.
Thanks in advance
Sri Hari A
Hi Pinal Dave,
I followed your instructions to install the northwind database, it worked! Thank you very much.
You are the man!
Greetings from the Netherlands,
KdV
Dear Bro,
Is there any impact if i delete Northwind and AdventureWorks db? I am not suppose to install it at my production db.
If yes, do i just right click on the db name and choose ‘delete’?
Thanks
Regards
Thanks a lot for making this easy -
My only wish would be that Microsoft would ship northwind as part of the SQL Server install!
Best regards,
Lee
I am someone who is entirely new in this field. Your article really did help me to install the two database. Thanks a lot.
Many thanks. Method 1 even worked! Just ensure you have closed down Visual Studio before you do it(Sounds obvious but I thought Id mention it.)
Thanks for this good tutorial, it is cool!
my name is urbain, i am learning sql so please i need your help, can you please send me adventure works database download to my email which is so i can download it to my computer and i can practice and please i need your help
Excellent Article. I love it.
Great. Thanks a lot. It was so quick to install the both databases.
gr88 job man.really helped me a lot
Hi:
I download SQL2000SampleDb.msi (288k).
But, I can’t run it.
It used ‘Windows installer’ to run that file and give me the following message.
“This installation package could not be opened. Contact the application vendor to verify that this is a valid Windows installer package.”
Can you tell me how to fix it? Thanks.
Regards,
JJ
[...] If you want to install AdventureWorks database version 2008, the methods works fine. There are additional sample database are available in the same package and they can be installed in 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. [...]
vaoov your are the best, five problems i had and you solve all of them easily. Loves from Turkey
Thanks a lot
hi i was trying to attach adventure works database but it gave me error stating failed to retrieve data for this request can u pls show some other way of attaching adventureworks database…
[...] recommendation : Start getting familiar with AdventureWorks. UPDATE: SQL SERVER – 2005 NorthWind Database or AdventureWorks Database – Samples Databases – Part 2 explains how to restored NorthWind to SQL Server 2000 using [...]
Thanks a bunch,you saved me a lot of time.You made it seem so simple
Sir, thanks for giving details about northwind and pubs….Can you tell me any site name to downlaod min 5000 Records.
thanks
arti
Desde Medellín, Colombia, Muchas gracias, EXCELENTE !Funciona perfecto.
:-)
According to the installation package, AdventureWorks installed correctly but I can not find it in order to attach it.
Also having trouble with attaching Northwind and Pubs. These I can find, but they fail to attach. I get the following message:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SQLServer.Express.ConnectionInfo)
Unable to open the physical file “C:\SQL Server 2000 Sample Databases\northwnd.mdf”. Operating system error 5: “5(Access is denied.)”. (Microsoft SQL Server, Error: 5120)
I am really in need of a fix for this. Thanks in advance.
Dear Pinal,
many thanks for instructions, they helped a lot. I did attach successfully Northwind and Pubs databases.
Kind regards,
Shavkat.
thanks man it helped me!!!
gv me sample databses
gr8 …. thanks alot
Hi Pinal -
You helped a lot! Great teaching skills – short and clear instructions. Thank you very much.
Julia
Dear Sir,
I m dhirendra Singh from DRDA, auraiya(UP). Plz, send me your course details and fee structure. I join your group.
Dhirendra Singh
Greate Job.!!
Hey thanks for the information.
It helped me to attach the sample databases
thanks for what u do
hello,
will this work in SQL server 2005 express edition?
thanks!
is this applicable in the express edition? i wanted to use the northwind in my sql2005expressed.. thanks
Thank you. Your example also works for SQL 2k8. Many thanks for your wonderful post.
Hi Dave,
can you explain how to configure Adveture works databasae in sql 2005.
and i need some help to extract full text from a column using prefix i tried but when i give 2 or 3 char for a word it shows blank why?
do explain
Thank you
Hi David, after hours looking and trying diferent things I finally found this site, I it took me 2 minutes to install pubs and nwnd, THANKS.
Santi
thanks,
Hello,
I m doing attach mdf file of sqlserver2000 to sqlserver2005 database but while attaching file, it is showing some error like..
mdf file is read only. you cant do this.
I also make file non read only but still it is showing the same.
Can you tell me the solution ??
Hi,
thankq very much for the instructions..easily installed northwind and pubs
hi deep,
Even i got the same problem…then i followed the method 2… with in 2 mins i installed the databases….
Thank you very much for the helpful tip on installation of the sample databases.
hi
after connecting the sql srever2005 management studio express with windows authentication, i am try to attach northwind database i got this errors
TITLE: Microsoft SQL Server Management Studio Express
——————————
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.Express.ConnectionInfo)
——————————
ADDITIONAL INFORMATION:
Could not load the DLL xpstar90.dll, or one of the DLLs it references. Reason: 126(The specified module could not be found.).
Could not load the DLL xpstar90.dll, or one of the DLLs it references. Reason: 126(The specified module could not be found.).
Could not load the DLL xpstar90.dll, or one of the DLLs it references. Reason: 126(The specified module could not be found.).
Could not load the DLL xpstar90.dll, or one of the DLLs it references. Reason: 126(The specified module could not be found.).
Could not load the DLL xpstar90.dll, or one of the DLLs it references. Reason: 126(The specified module could not be found.).
Could not load the DLL xpstar90.dll, or one of the DLLs it references. Reason: 126(The specified module could not be found.).
Could not load the DLL xpstar90.dll, or one of the DLLs it references. Reason: 126(The specified module could not be found.).
Could not load the DLL xpstar90.dll, or one of the DLLs it references. Reason: 126(The specified module could not be found.).
Could not load the DLL xpstar90.dll, or one of the DLLs it references. Reason: 126(The specified module could not be found.). (Microsoft SQL Server, Error: 17750)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.1399&EvtSrc=MSSQLServer&EvtID=17750&LinkId=20476
——————————
BUTTONS:
OK
——————————
pls help me
Thanks Pinal
Thanks for help.
Wow,easy way to install both Northwind and Pubs Databases for SQL Server 2005…Thanks a lot
For a fresher like me…this is a very very helpfull information
Thank’s a lot
It is very useful for a newbie. Thank you.
Thanks a lot! Very usefull to me.
Thanks a lot . it was really helpful
I wish I had comea across this page a lot earlier. Its clear and concise. Thank you
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)