posted on Friday, January 06, 2006 10:54 AM
by
bknight
Pubs and Northwind databases not installed in SQL Server 2005
I love the new Microsoft SQL Server 2005 sample databases (AdventureWorks and AdventureWorksDW). Compared with the Northwind and even worse the Pubs databases, they're amazingly more real-world. They show best practices and demostrate a good portion of the 2005 features. The problem lies in a lot of the SQL Server 2000 examples on the Internet still work in SQL Server 2005 and content that's specific to 2005 is still being produced. So, what to do while you wait for the examples to be updated? Why not live like it's 2002 and install the SQL Server 2000 sample databases? That way the sample RDL files, T-SQL scripts and most other examples on the net will work.
To do this, you'll need to download them at: http://www.microsoft.com/downloads/details.aspx?familyid=06616212-0356-46a0-8da2-eebc53a68034&displaylang=en
Run the SQL2000SampleDb.msi file to extract the files to the strangely placed directory C:\SQL Server 2000 Sample Databases (no you can't change this I'm afraid). Then you can run the scripts in the directory to install the databases or attach the data files. Instpubs.sql creates the pubs sample database and Instnwnd.sql creates the Northwind sample database. If you don't have the SQL tools installed, you can use SQLCMD from a DOS prompt to install them as shown below:
c:\sqlcmd -S .\InstanceName -i instpubs.sql
c:\sqlcmd -S .\InstanceName -i instnwnd.sql
If you do have the tools, just run the scripts in the Query Window of SQL Server Management Studio. The MDF and LDF files are there for attachment. Another method is to right-click on the database tree and click Attach, pointing to the MDF and LDF files. Before doing this though copy the files to the instance's Data directory. After the attachment or script is run, you can remove the directory and files through Add\Remove Programs.
PS: Don't get in the habit of creating new scripts against these databases, as they no longer represent the current technology strategies you would employ.
-- Brian Knight