Reinstalling Sample Databases from Script
If you have made changes to a sample database and want to return to the original schema, you can reinstall the database by running the appropriate installation script from Microsoft SQL Server Management Studio Query Editor. The installation script removes the existing sample database, re-creates the database objects, and populates the tables.
Alternatively, you can download the AdventureWorks database at the SQL Server Developer Web site.
Note
These procedures do not apply to SQL Server 2005 Express Edition or SQL Server Compact Edition. To download AdventureWorks for these editions, see Installing Sample Databases for Express Editions.
The following procedures describe how to reinstall the AdventureWorks database and the AdventureWorksDW data warehouse.
To reinstall AdventureWorks from script
On the Management Studio toolbar, click File, point to Open and then click File.
Browse to the file instawdb.sql and click Open. The default location of this file is C:\Program Files\Microsoft SQL Server\90\Tools\Samples\AdventureWorks OLTP.
Before running the script, locate the statement
SET @data_path = @sql_path + 'AWDB\';
in the script and change the statement to point to the location of the instawdb.sql script. For example,SET @data_path = 'C:\Program Files\Microsoft SQL Server\90\Tools\Samples\AdventureWorks OLTP\';
.Execute the script.
To reinstall AdventureWorksDW from script
On the Management Studio tool bar, click File, point to Open and then click File.
Browse to the file instawdwdb.sql and click Open. The default location of this file is C:\Program Files\Microsoft SQL Server\90\Tools\Samples\AdventureWorks Data Warehouse.
Before running the script, locate the statement
SET @data_path = @sql_path + 'awdwdb\';
in the script and change the statement to point to the location of the instawdwdb.sql script. For example,SET @data_path = 'C:\Program Files\Microsoft SQL Server\90\Tools\Samples\AdventureWorks Data Warehouse\';
.Execute the script.
See Also
Concepts
Running Setup to Install AdventureWorks Sample Databases and Samples