How to: Install Sample Databases
Many data examples require the ability to connect to the Northwind, Pubs, andAdventureWorks sample databases. You can install and connect to these databases by using the following procedures.
Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Customizing Development Settings.
Many data examples require the availability of sample databases that can be downloaded from web sites. The sample databases include the AdventureWorks, Northwind, and Pubs databases.
To install the Northwind and Pubs sample databases for SQL Server
Go to the Northwind and Pubs Sample Databases web site.
Download and run the installer.
The installer adds a folder SQL Server 2000 Sample Databases to the root folder on your computer. (For example: C:\SQL Server 2000 Sample Databases).
Locate the SQL script for the database you want, Northwind or Pubs.
The .MDF database file cannot easily be converted to a format that you can use in current versions of SQL Server, so it's best to use the script to create the database.
In Server Explorer, create a connection to a SQL Server instance where you want to install the database. If you don't have a specific SQL Server that you want to use, you can use the database that's automatically installed with Visual Studio. To do that, specify (localdb)\v11.0 as the server name.
To create the connection, follow these steps.
To create a connection to an instance of SQL Server
In Server Explorer, open the shortcut menu for the Data Connections node, and choose Add Connection.
The Add Connection dialog box appears.
Enter the name of the SQL Server where you want to create the Northwind or Pubs database, or enter (localdb)\v11.0.
Under Select or enter a database name, choose any database from the list, for example, tempdb.
Choose the Test Connection button to verify that everything is working, and then choose the OK button.
A new connection node appears in Server Explorer.
On the shortcut menu for the connection node for your server, and then choose the New Query button.
An editor window opens and shows an empty .sql script file.
Paste the contents of instnwnd.sql or instpubs.sql into the editor window.
Delete the following lines from the instnwnd.sql script.
exec sp_dboption 'Northwind','trunc. log on chkpt.','true' exec sp_dboption 'Northwind','select into/bulkcopy','true'
In the instpub.sql file, delete the following line:
execute sp_dboption 'pubs' ,'trunc. log on chkpt.' ,'true'
Replace the deleted lines with following line for Northwind:
ALTER DATABASE Northwind SET RECOVERY SIMPLE
Or replace the deleted line with the following line for pubs:
ALTER DATABASE pubs SET RECOVERY SIMPLE
This code sets up a backup model for the database.
To install the AdventureWorks sample databases
Download the AdventureWorks sample databases from the CodePlex Web site.
To install the Northwind sample database for Microsoft Access
Go to Desktop Northwind 2007 sample database on the Microsoft web site, and then choose the Download button.
In Microsoft Access, save the database file.