When you install SQL Server 2005, if you select the default installation, the AdventureWorks database is not installed. Because many tutorials and examples require the use of AdventureWorks databases, it is necessary to install the AdventureWorks database. This article will discuss how to obtain and install this database.
Download and install AdventureWorks
First, go to the Microsoft Official website Download Adventureworksdb.msi, this is the AdventureWorks installation program. Then copy the file and related files to your computer. Adventureworksbi.msi (BI is the abbreviation for Business Intelligence).
Run the installation files so that the two databases are installed on your computer. However, the database installation is not fully completed. There are two ways to complete the installer: You can use SQLCMD, which looks like a DOS window. Or use a graphical interface to install. The following is a description of the two methods.
Method 1
Run SQL Server Management Studio. Click the Eighth button on the right of the toolbar to open the Sqlcmd window (the icon is a red exclamation mark). Enter the directive in listing a.
execsp_attach_db @dbname=N'AdventureWorks',
@filename1=N'C:\Program Files\Microsoft sql server
mssql.1\mssql\Data\AdventureWorks_Data.mdf',
?@filename2=N'C:\Program Files
Microsoft sql server
mssql.1\mssql\Data\AdventureWorks_log.ldf'
Tip: If you do not select a default installation, 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 input, the graphical interface can connect multiple databases in the simplest way. The steps are as follows:
1. In Object Explorer (Project Explorer), select the database schema.
2, click the right mouse button, choose to connect to the Tear-off menu, open the Database Connection dialog box.
3, click the Add button, and then determine the database location to increase (you can also join multiple databases at one time).
Considerations for connecting to a database
Although the structure of the files in SQL Server 2005 has changed, you can still connect to the SQL Server 2000 database. But only by selecting a new format for the database to experience the new features of SQL Server 2005, you can choose one way at a random.