Export (0) Print
Expand All

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.

NoteNote

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

  1. Go to the Northwind and Pubs Sample Databases web site.

  2. 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).

  3. Locate the SQL script for the database you want, Northwind or Pubs.

    Caution note Caution

    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.

  4. 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

    1. In Server Explorer, open the shortcut menu for the Data Connections node, and choose Add Connection.

      The Add Connection dialog box appears.

    2. Enter the name of the SQL Server where you want to create the Northwind or Pubs database, or enter (localdb)\v11.0.

    3. Under Select or enter a database name, choose any database from the list, for example, tempdb.

    4. 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.

  5. 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.

  6. Paste the contents of instnwnd.sql or instpubs.sql into the editor window.

  7. 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

To install the Northwind sample database for Microsoft Access

  1. Go to Desktop Northwind 2007 sample database on the Microsoft web site, and then choose the Download button.

  2. In Microsoft Access, save the database file.

The new extension for Access databases is .accdb. See Data Programming with Microsoft Access 2010. To connect to the Northwind database by using Access, see How to: Connect to the Northwind Database.

The sample databases are for illustration only, and do not necessarily demonstrate the best security practices.

Show:
© 2014 Microsoft