When installing SQL server 2005, if you choose the default installation, the AdventureWorks database will not be installed. Because many tutorials and examples require the AdventureWorks database, it is necessary to install the AdventureWorks database. This article discusses how to obtain and install this database.
Download and install AdventureWorks
First, go to Microsoft's official website to download AdventureWorksdb.msi, which is the installation program for AdventureWorks. Then copy this file and related files to your computer. AdventureWorksBI.msi (BI stands for business intelligence).
Run the installation file so that both databases are installed on your computer. But the installation of the database is not actually completely completed. There are two ways to complete the installer: You can use sqlcmd, which looks like a dos window. Or install using the graphical interface. Below are instructions for both methods.
Method 1
Run SQL Server Management Studio.
Click the eighth button from the right of the toolbar to open the sqlcmd window (the icon is a red exclamation mark).
Enter the instructions in Listing A.
execsp_attach_db @dbname=N'AdventureWorks',
@filename1=N'C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLDataAdventureWorks_Data.mdf',?@filename2=N'C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLDataAdventureWorks_log.ldf'
Tip: If the default installation is not selected, you must enter the correct path to the file.
Method 2:
This method connects to the database through a graphical interface. In addition to saving the entered content, the graphical interface can connect multiple databases in the simplest way. The steps are as follows:
1. Select the database mode in Object Explorer (Project Explorer).
2. Right-click the mouse and select Connect to tear-off menu to open the database connection dialog box.
3. Click the Add button, and then determine the location of the database to be added (you can also add multiple databases at one time).
Notes on Connecting to Databases
Although the file structure has changed in SQL Server 2005, you can still connect to SQL Server 2000 databases. But only by choosing the new format of the database can you experience the new features of SQL Server 2005. You can choose any method.