- Business Intelligence with MicroStrategy Cookbook
- Davide Moraschi
- 411字
- 2021-07-23 15:31:58
Setting up the AdventureWorks DW sample database
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.
Getting ready
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
.
How to do it...
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:
- Create a directory named
C:\datawarehouse
; this will be the location of our database. - Open in Notepad the file
instawdwdb.sql
and modify lines 36 and 37 so that they look like::setvar SqlSamplesDatabasePath "C:\datawarehouse\" :setvar SqlSamplesSourceDataPath "C:\install\AdventureWorks 2008R2 Data Warehouse\"
Tip
The two hyphens at the beginning of the lines (comment marks) have been removed and the path to data folder and source scripts folder have been modified, they both include the trailing backslash.
- Save the file and close Notepad.
- Open a command prompt and enter the following command:
sqlcmd -S (localdb)\v11.0 –i "C:\install\AdventureWorks 2008R2 Data Warehouse\instawdwdb.sql"
Tip
This command must be written all in one line and including the double quotes.
How it works...
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.
There's more...
In order to check if everything was installed correctly, we will perform a couple of very simple SQL queries on the database:
- Open the
sqlcmd
utility again:sqlcmd -S (localdb)\v11.0
- At the
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!
Exercise 1
From the sqlcmd utility execute the queries to count the number of records in the following tables: FactCurrencyRate
, FactResellerSales
, DimGeography
, DimDate
, and DimCurrency
. Note down the numbers.
- 自愿審計動機與質量研究:基于我國中期財務報告審計的經驗證據
- Microsoft System Center Data Protection Manager 2012 SP1
- 審計基礎
- 《企業內部控制基本規范》合規實務指南
- 從零開始學房地產會計
- 行政單位經濟責任審計實務指南
- 2017年度注冊會計師全國統一考試專用教材(圖解版):審計
- Oracle Primavera Contract Management,Business Intelligence Publisher Edition v14
- Amazon EC2 Cookbook
- 規范內部審計的28個技巧
- 舞弊審計實務指南
- PMP 5A備考寶典
- TIBCO Spotfire for Developers
- 審計實務
- 非參數統計:基于R語言案例分析