AdventureWorks 2008 OLTP Script

Rating:        Based on 6 ratings
Reviewed:  4 reviews
Downloads: 58735
Released: Jun 13, 2012
Updated: Jun 14, 2012 by DerrickVMSFT
Dev status: Stable Help Icon

Recommended Download

Application AdventureWorks 2008 OLTP
application, 21329K, uploaded Jun 14, 2012 - 58735 downloads

Release Notes

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

1. Download AdventureWorks 2008 OLTP
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.

Reviews for this release

Fantastic!!! Thanks so much, followed the instructions and now have a fully populated sample database in my new sqlserver 2008 express installation. Brilliant brilliant brilliant, can't thank you enough for your hard work. Cheers, Max
by Max7 on Oct 13, 2012 at 6:06 PM
It works. Make sure you follow the instructions in the code and select SQLCMD mode in SSMS.
by kevinescott on Aug 18, 2012 at 7:17 AM
Worked fine with Win7 and SQL Server 2008 Express only needed to copy the sample database to the root folder and un comment the setvar on lines 37 & 38
by WilliamM on Aug 9, 2012 at 10:01 PM
Very good work. Remember to read the top instruction to set the variables right. Additionally, I created another variable for the log file path. I keep the MDF and LDF files in different folders. Then open command prompt and for localhost installtion use "sqlcmd -S localhost -i installdb.sql" and you are done. Very neat.
by debasisg on Jul 6, 2012 at 3:03 PM