1. Download AdventureWorks 2008 OLTP Script.zip file from below link.
2. Extract zip file into “AdventureWorks 2008 OLTP Script” folder.
3. In the Script folder you will find collection of .csv files and one AdventureWorks DDL script file named “instawdb.sql”.
4. Open instawdb.sql DDL Script File in SQL Server Management Studio.
5. Update the DDL script path variables (See Fig 1).
Fig. 1 shows instawdb.sql DDL script file in SSMS. This script depends on two path variables SqlSamplesDatabasePath and SqlSamplesSourceDataPath. SqlSamplesDatabasePath will take path of the folder where AdventureWorks database files will be stored after installation while SqlSamplesSourceDataPath should be set with the actual path of “AdventureWorks 2008 OLTP Script” folder where you have all the csv files in your system. Before running this script in SSMS, You should uncomment setvar commands of both path variables and also both path variables should be set with necessary and appropriate values(As specified in Fig. 1 above). An invalid SqlSamplesSourceDataPath path will generate an error that the bulk load steps failed because the .csv files could not be found.
6. Run DDL Script only in SQLCMD mode. On the Query menu click on SQLCMD Mode. You will find SQLCMD mode menu in Query -> SQLCMD Mode in SSMS.
7. On a SSMS toolbar click on Execute or Press F5 to execute DDL script.
After successful execution of DDL script you will have the AdventureWorks database in your SQL Server 2008 Instance.
I will show you other methods of installing AdvantureWorks database in SQL Server 2008, in my future posts.
Please share your thoughts in the comment section.