Now that the instance is up and running, we can load the data into it. First, we'll create a database that will be populated with sample data.
You need to have completed the previous recipe to continue, and then unzip the AdventureWorks 2008R2 Data Warehouse.zip
file into the folder C:install
, so that you will end up with a folder named AdventureWorks 2008R2 Data Warehouse
containing a series of SQL script files; the main being named instawdwdb.sql
.
Before running this script we need to modify it, in order to specify the name of the source folder containing the CSV files and the name of the destination folder that will store the resulting database:
C:datawarehouse
; this will be the location of our database.instawdwdb.sql
and modify lines 36 and 37 so that they look like::setvar SqlSamplesDatabasePath "C:datawarehouse" :setvar SqlSamplesSourceDataPath "C:installAdventureWorks 2008R2 Data Warehouse"
sqlcmd -S (localdb)v11.0 –i "C:installAdventureWorks 2008R2 Data Warehouseinstawdwdb.sql"
The script will create the database and all the needed tables. Then will import the CSV data files into the tables to populate them with data. The script will lastly exit the sqlcmd
command interface.
In order to check if everything was installed correctly, we will perform a couple of very simple SQL queries on the database:
sqlcmd
utility again:sqlcmd -S (localdb)v11.0
1>
prompt, write the following instructions each on its own line, followed by the Enter key:use AdventureWorksDW2008R2 go select count(1) from FactInternetSales go select count(1) from DimCustomer go exit
The database will respond with the number of rows in the main fact table and the customer dimension table, 60398
and 18484
respectively.
Congratulations, you correctly installed the data warehouse source database!