Install AdventureWorks2008 OLTP database from script
The AdventureWorks database can be created by running the instawdb.sql DDL script contained in the
AdventureWorks 2008 OLTP Script.zip file. The instawdb.sql script depends on two path environment variables: SqlSamplesDatabasePath and SqlSamplesSourceDataPath. The SqlSamplesDatabasePath environment variable is set to the default Microsoft ® SQL Server 2008 path. You will need to change the SqlSamplesSourceDataPath environment variable to the path containing the AdventureWorks 2008 OLTP Script files.An invalid SqlSamplesSourceDataPath path generates an error that the bulk load steps failed because the .csv files could not be found. The DDL script must be ran in SQLCMD mode inside SQL Server Management Studio.
To install AdventureWorks2008 OLTP database from script1. Download
AdventureWorks 2008 OLTP Script.zip.
2. Copy the DDL script files to C:\{AdventureWorks 2008 OLTP Script Path}.
3. Open C:\{AdventureWorks 2008 OLTP Script Path}\instawdb.sql in SQL Server Management Studio.
4. Update the script path variables.
If necessary, change the :setvar SqlSamplesDatabasePath variable to your SQL Server 2008 path. The default path is C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER \MSSQL\DATA.
Change the :setvar SqlSamplesSourceDataPath variable to the path containing the .csv files.
5. On the Query menu, click SQLCMD Mode.
6. On the Standard toolbar, click the Execute button to run the script.