241 101 1MB
Russian Pages 98 Year 2002
В
OLAP ,
Ч
1.
OLAP
OLAP
«
»,
,
, , Business Intelligence —
— ,
,
, , Business Intelligence
.
,
,
,
, . ,
,
. Services
OLAPMicrosoft SQL Server 2000), .
Microsoft (
Analysis
,
OLAP (On-Line Analytical Processing) —
. OLAP, OLAP,
OLAP-
, ,
.
Ч ,
, ,
. . —
.
, warehouses),
, , .
.
(Data
, ( ).
(Ralph Kimball), , « , » ( ., , Ralph Kimball, «The Data Warehouse Toolkit: Practical Techniques for Building Dimensional Data Warehouses», John Wiley & Sons, 1996 «The Data Webhouse Toolkit: Building the Web-Enabled Data Warehouse», John Wiley & Sons, 2000). :
• • • • • •
; ; (slice and dice); ; ; .
. , ,
—
, ,
.
-
—
. .
,
,
, , .
, ,
,
,
,—
. -
, ,
: (
,
,
—
). ,
.
-
,
,
.
Ч
, .
,
OLAP
. ,
,
( ,
)
(
), 1
,
—
.
, . ,
,
.
Analytical Processing). OLAP — OLAP
Э
, ( . E.F. Codd, S.B. Codd, and C.T.Salley, Providing OLAP (on-line analytical processing) to user-analysts: An IT mandate. Technical report, 1993). 1995 , , FASMI (Fast Analysis of Shared Multidimensional Information —
1
1993
OLAP (On-Line .
, ,
.
), : •
( 5 ),
•
; , , ;
•
;
•
, (
•
—
OLAP);
. ,
OLAP-
, , .
, ,
OLAP
.
OLAP .
, OLAP, Microsoft SQL Server
Northwind, Microsoft Access
,
, .
,
,
,
, ,
,
. Microsoft SQL Server
Northwind
Microsoft Access —
. OLAP Products
Categories
Invoices Northwind,
, :
SELECT dbo.Invoices.Country, dbo.Invoices.City, dbo.Invoices.CustomerName, dbo.Invoices.Salesperson, dbo.Invoices.OrderDate, dbo.Categories.CategoryName, dbo.Invoices.ProductName, dbo.Invoices.ShipperName, dbo.Invoices.ExtendedPrice FROM dbo.Products INNER JOIN dbo.Categories ON dbo.Products.CategoryID = dbo.Categories.CategoryID INNER JOIN dbo.Invoices ON dbo.Products.ProductID = dbo.Invoices.ProductID
Access 2000
:
SELECT Invoices.Country, Invoices.City, Invoices.Customers.CompanyName AS CustomerName, Invoices.Salesperson,
Invoices.OrderDate, Categories.CategoryName, Invoices.ProductName, Invoices.Shippers.CompanyName AS ShipperName, Invoices.ExtendedPrice FROM Categories INNER JOIN (Invoices INNER JOIN Products ON Invoices.ProductID = Products.ProductID) ON Categories.CategoryID = Products.CategoryID;
Э
Invoices, Categories Products, , , , ,
, , , ,
-
. ,
, ,
. ,
Invoices1.
. 1.
. 1.
Invoices1
? : • • •
, ,
?
Speedy Express? , Speedy Express?
1997
SQL 2 (
. 1).
1 В
SQL,
SELECT SUM (ExtendedPrice) FROM invoices1 WHERE Country=’France’
? ,
SELECT SUM (ExtendedPrice) FROM invoices1 WHERE Country=’France’ AND ShipperName=’Speedy Express’
Speedy Express? ,
SELECT SUM (ExtendedPrice) FROM Ord_pmt WHERE CompanyName=’Speedy Express’ AND OrderDate BETWEEN ‘December 31, 1995’ AND ‘April 1, 1996’ AND ShipperName=’Speedy Express’
1996 Speedy Express?
. ‘France’
‘Austria’ .
, ,
( Country Argentina Austria Belgium Brazil Canada Denmark Finland France Germany …
): SUM (ExtendedPrice) 7327.3 110788.4 28491.65 97407.74 46190.1 28392.32 15296.35 69185.48 209373.6 …
( .Э
—
GROUP BY
)
:
SELECT Country, SUM (ExtendedPrice) FROM invoices1 GROUP BY Country
, WHERE. Country (
, ShipperName, ):
ShipperName Country
2
, Microsoft English Query,
Federal Shipping Speedy Express United Package
Argentina 1 210.30
1 816.20
5 092.60
Austria
41 004.13
46 128.93
40 870.77
,
SQL.
Belgium
11 393.30
4 717.56
17 713.99
Brazil
16 514.56
35 398.14
55 013.08
Canada
19 598.78
5 440.42
25 157.08
Denmark
18 295.30
6 573.97
7 791.74
Finland
4 889.84
5 966.21
7 954.00
France
28 737.23
21 140.18
31 480.90
Germany
53 474.88
94 847.12
81 962.58
…
…
…
…
(pivot table)
-
(cross
table, crosstab). — Paradox DOS Microsoft Access 2000:
Microsoft Excel 2000.
,
,
TRANSFORM Sum(Invoices1.ExtendedPrice) AS SumOfExtendedPrice SELECT Invoices1.Country FROM Invoices1 GROUP BY Invoices1.Country PIVOT Invoices1.ShipperName;
GROUP BY: SELECT Country,ShipperName, SUM (ExtendedPrice) FROM invoices1 GROUP BY COUNTRY,ShipperName
,
,
, (
Country ShipperName Argentina Federal Shipping Austria Federal Shipping Belgium Federal Shipping Brazil Federal Shipping … …
): SUM (ExtendedPrice) 845.5 35696.78 8747.3 13998.26 …
WHERE. ,
(
. 2).
. 2.
,
. 2,
, WHERE. ,
( ,
cross-sections ,
,
GROUP BY. , Microsoft Excel 2000) , (workbook).
(
slices).
WHERE (
, ,
OLAP-
)
4-
, , 5-
. . ,
OLAP,
—
,— ( «
.
OLAPSQL, ,
(
,
), measure, «
», (members).
MIN, MAX, AVG, COUNT, . .). summary ( , — », OLAP). ,
dimension , ,
,
, .
,
,
,
,
,
, .
, ,
.
, ,
,— .
,
—
,
.
,
,
—
(
. 3. И
,
, ,
(balanced), . 3,
»,
),
,
,
(unbalanced). « — Salesperson . 4.
—
—
. 3).
« » (
,
, — ,
. 4.
Parent-child hierarchy. , ( «
»). (
Country, City
ragged —
,
«
»
,
State,
, Country
City;
. 5).
. 5. « , OLAP, OLAP-
»
« » . , Microsoft Analysis Services 2000 Microsoft OLAP Services 7.0 — , ,
. .
Ч
2.
OLAP
OLAP (On-Line Analytical Processing) —
. OLAP, OLAP, .
OLAP-
, ,
, ,
OLAP
, .
,
OLAP ,
.
OLAP
, .
OLAP.
,
(Data Warehouse). ,
,
, ,
, . .
.
,
(
),
. Northwind,
Microsoft SQL Server . 1.
Microsoft Access.
. 1.
Northwind (fact
table)
(dimension tables).
.
,
, .
.
: •
,
(Transaction facts). ( );
•
,
« (
» (Snapshot facts). )
,
,
. •
; (Line-item facts). ) , , ); (Event or state facts). ( , ).
, (
, (
•
,
,
,
(
,
). , «
/
, .
,
»—
,
,
,
— , OLAP-
. , . , Northwind,
. 2.
. 2.
,
—
.
, ,
( ). , —
.
OLAP(
OLAP-
.
,
,
), .
,
, .
,
,
, . Э
,
,
.
. . (
) 3
( . ,
, «
,
,
)
, ,
»
. ,
«
( »,
(
) « ),
»
, (
,
). «
»
. , ; ,
,
,
,
. . 3.
3
—
,
.
. 3. ( ),
, .
,
«
schema).
» (star
. 4.
. 4.
«
» ,
«
» (snowflake schema).
, «
»
,
, (outrigger table).
«
»
. 5.
. 5.
«
»
, «
». .
,
, «
«
».
. ( Northwind,
Employees
,
, EmployeeID,
, (
.
. 1)
«
»
.
»,
, . — .
—
(
,
1 (
,
-
),
, ). ,
(
. 3).
,
,
(member properties). . , , .
Sybase Adaptive Server IQ, ( , .
). , OLAP-
, ,
OLAP-
OLAP-
,
.
OLAP , OLAP-
.
OLAP-
, (
)
,
,
, OLAP-
. ,
OLAPOLAP-
.
— SQL-
GROUP BY,
,
,
,
.
, OLAP( StatSoft
SPSS)
.
,
Microsoft Excel 2000. OLAP-
(
,
, ,
.
, DecisionCube
, OLAPBorland Delphi Borland C++Builder). ActiveX .
,
OLAP-
,
( ,—
,
) , .
OLAP-
,
,
. (
!)
OLAP, ,
.
,
, . ,
,
.
, ,
, .
OLAP,
,
OLAP-
, . .
. OLAPOLAP: , ,
, ,
. , , , Oracle Express Server, Microsoft SQL Server Crystal Decisions, BusinessObjects,
OLAP, , 2000 Analysis Services, Hyperion Essbase, Cognos, SAS Institute. ( ) , , Seagate Analysis
OLAPOLAP-
,
. OLAP.) , , .
OLAP-
( OLAP-
, Microsoft Excel 2000, , . OLAP-
, .
,
,
,
,
,
. .
—
, ,
.
. ,
. ,
(
«
»
,
, ).
,
.
«
»
, . ,
, .
: •
MOLAP (Multidimensional OLAP) –— . , . ,
• •
. ROLAP (Relational OLAP) — ,
. .
HOLAP (Hybrid OLAP) — , .
,
OLAP,
—
.
OLAP-
. , OLAP-
.
, «
»
OLAP(
).
«
»
Ч
3. А
Microsoft Analysis Services
SQL DSO PivotTable Service, OLE DB for OLAP
ADO MD
Analysis Manager Microsoft Office
OLAP,
,
. , .
. ,
Microsoft SQL Server , ,
(Data
Transformation Services, DTS). Microsoft SQL Server, ADO «
, OLE DB ( »,
« » ,
ins) OLAP-
OLE DB
). DTS
(plug,
.
OLAP,
SQL DSO
,
.
, ).
Analysis Services (
Access msmdrep.mdb,
Microsoft Analysis Services\Bin, Microsoft SQL Server. ,
,
OLE DB
ODBC. ,
SQL DSO,
, .
OLAP (On-Line Analytical Processing) —
,
.
OLAP, Microsoft,
Microsoft Analysis Services — OLAPMicrosoft SQL Server 2000 Enterprise Edition Gartner Group .
Ч ,
OLAP
.
, ,
. ,
OLAP, ( ).
OLAP
. , ,
OLAP,
. OLAP. , , — OLAP-
OLAP-
.
, OLAPMicrosoft (Microsoft Analysis Services), Microsoft SQL Server 2000 Enterprise Edition. Analysis Server — OLAP-
Windows NT/2000. Э , .
, .
Ч OLAP-
,
Microsoft,
,
. , ,
,
,
Multidimensional OLAP, ,
Relational OLAP
Hybrid OLAP ( ).
, .
(
,
,
members)
(
VBA
. .). , Analysis Services Excel,
). (calculated ,
,
, .
,
,
, ,
(library),
, (shared dimensions). (private dimensions).
,
, ,
Microsoft
(virtual cubes), (view)
.
, ,
.
,
OLAP-
,
,
.Э
OLAPOLAP-
.
: -
,
.
SQL DSO Decision Support Objects (DSO) — (
, SQL DSO, —
, . .).
,
COM-
Analysis Manager — .
Э
,
, , , (
, . 1).
. 1. , Microsoft. .
,
SQL DSO OLAP-
SQL DSO
,
SQL DSO
.
PivotTable Service, OLE DB for OLAP и ADO MD ,
— Microsoft SQL Server 2000 PivotTable Service , Microsoft Office. PivotTable Service OLAPOLAP, .Э OLAP-
OLAP, PivotTable Service — , .Э ( , Microsoft Office 2000.
),
,
32,
,
Windows
,
OLAP,
,
. OLAP-
,
. PivotTable Service OLE DB for OLAP — , OLE DB for OLAP
OLE DB, ,
ADO MD — COM-
, ,
.
OLE DB for OLAP OLAP,
OLE DB, PivotTable Service, OLE DB for OLAP
OLAP-
. Э , OLE DB for OLAP ( ),
ADO MD.
.
,
,
,
.
Analysis Manager Analysis Manager
, OLAP (
. 2).
. 2. Analysis Manager Analysis Manager ,
ActiveX, OLE DB for OLAP.
Analysis Manager
SQL DSO OLE DB
.
,
Analysis Manager
Прил
,
,
OLE DB for OLAP.
ия Microsoft Office , OLAPMicrosoft Excel. -
,
, Excel Excel
OLAPOLE DB ( . 3).
. 3.
Excel
OLAP-
Microsoft Office, OLAP, , ,
, Microsoft Office Web Components ActiveX PivotTable List, Windows, HTML, ( . 4).
. 4.
PivotTable List
OLAP-
Microsoft Office . , , Service, OLE DB for OLAP
. 5.
Microsoft Office OLAPADO MD (
,
, OLAP,
.
. 5).
PivotTable Service OLE DB for OLAP
, PivotTable
Ч
4. Data Transformation Services Data Transformation Services DTS
DTS OLAPMicrosoft Analysis Services — OLAPMicrosoft, Microsoft SQL Server 2000 Enterprise Edition Gartner Group , , OLAPMicrosoft Analysis Services. OLAP-
,
,
,
, ,
,
.
.
, .
, ,
. ,
, ,
Northwind , . 1,
Microsoft SQL Server 2000. « ».
.
. 1.
Northwind_Mart, Northwind (
1. 1 CREATE DATABASE Northwind_Mart ON PRIMARY ( NAME=Northwind_Mart_Data, FILENAME='d:\Program Files\Microsoft SQL Server\mssql\data\Northwind_Mart_Data.MDF', SIZE=5MB, FILEGROWTH=10% ) LOG ON ( NAME=Northwind_Mart_Log, FILENAME='d:\Program Files\Microsoft SQL Server\mssql\data\Northwind_Mart_Log.LDF', SIZE=2MB, FILEGROWTH=10% ) GO USE Northwind_Mart GO CREATE TABLE [dbo].[Customer_Dim] ( [CustomerKey] [int] IDENTITY (1, 1) NOT NULL , [CustomerID] [nchar] (5) NOT NULL , [CompanyName] [nvarchar] (40) NOT NULL , [ContactName] [nvarchar] (30) NOT NULL , [ContactTitle] [nvarchar] (30) NOT NULL , [Address] [nvarchar] (60) NOT NULL , [City] [nvarchar] (15) NOT NULL , [Region] [nvarchar] (15) NOT NULL , [PostalCode] [nvarchar] (10) NULL ,
Northwind_Mart) —
[Country] [nvarchar] (15) NOT NULL , [Phone] [nvarchar] (24) NOT NULL , [Fax] [nvarchar] (24) NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[Employee_Dim] ( [EmployeeKey] [int] IDENTITY (1, 1) NOT NULL , [EmployeeID] [int] NOT NULL , [EmployeeName] [nvarchar] (30) NOT NULL , [HireDate] [datetime] NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[Product_Dim] ( [ProductKey] [int] IDENTITY (1, 1) NOT NULL , [ProductID] [int] NOT NULL , [ProductName] [nvarchar] (40) NOT NULL , [SupplierName] [nvarchar] (40) NOT NULL , [CategoryName] [nvarchar] (15) NOT NULL , [ListUnitPrice] [money] NOT NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[Sales_Fact] ( [TimeKey] [int] NOT NULL , [CustomerKey] [int] NOT NULL , [ShipperKey] [int] NOT NULL , [ProductKey] [int] NOT NULL , [EmployeeKey] [int] NOT NULL , [RequiredDate] [datetime] NOT NULL , [LineItemFreight] [money] NOT NULL , [LineItemTotal] [money] NOT NULL , [LineItemQuantity] [smallint] NOT NULL , [LineItemDiscount] [money] NOT NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[Shipper_Dim] ( [ShipperKey] [int] IDENTITY (1, 1) NOT NULL , [ShipperID] [int] NOT NULL , [ShipperName] [nvarchar] (40) NOT NULL ) ON [PRIMARY] GO CREATE TABLE [dbo].[Time_Dim] ( [TimeKey] [int] IDENTITY (1, 1) NOT NULL , [TheDate] [datetime] NOT NULL , [DayOfWeek] [nvarchar] (20) NOT NULL , [Month] [int] NOT NULL , [Year] [int] NOT NULL , [Quarter] [int] NOT NULL , [DayOfYear] [int] NOT NULL , [Holiday] [nvarchar] (1) NOT NULL , [Weekend] [nvarchar] (1) NOT NULL , [YearMonth] [nvarchar] (10) NOT NULL , [WeekOfYear] [int] NOT NULL ) ON [PRIMARY] GO ALTER TABLE [dbo].[Customer_Dim] WITH NOCHECK ADD CONSTRAINT [PK_Customer_Dim] PRIMARY KEY NONCLUSTERED ([CustomerKey]) ON [PRIMARY] GO ALTER TABLE [dbo].[Employee_Dim] WITH NOCHECK ADD
CONSTRAINT [PK_Employee_Dim] PRIMARY KEY ([EmployeeKey]) ON [PRIMARY]
NONCLUSTERED
GO ALTER TABLE [dbo].[Product_Dim] WITH NOCHECK ADD CONSTRAINT [PK_Product_Dim] PRIMARY KEY NONCLUSTERED ([ProductKey]) ON [PRIMARY] GO ALTER TABLE [dbo].[Sales_Fact] WITH NOCHECK ADD CONSTRAINT [PK_Sales_Fact] PRIMARY KEY NONCLUSTERED ( [TimeKey], [CustomerKey], [ShipperKey], [ProductKey], [EmployeeKey] ) ON [PRIMARY] GO ALTER TABLE [dbo].[Shipper_Dim] WITH NOCHECK ADD CONSTRAINT [PK_Shipper_Dim] PRIMARY KEY NONCLUSTERED ([ShipperKey]) ON [PRIMARY] GO ALTER TABLE [dbo].[Time_Dim] WITH NOCHECK ADD CONSTRAINT [PK_Time_Dim] PRIMARY KEY NONCLUSTERED ([TimeKey]) ON [PRIMARY] GO ALTER TABLE [dbo].[Sales_Fact] ADD CONSTRAINT [FK_Sales_Fact_Customer_Dim] FOREIGN KEY ([CustomerKey]) REFERENCES [dbo].[Customer_Dim] ([CustomerKey]), CONSTRAINT [FK_Sales_Fact_Employee_Dim] FOREIGN KEY ([EmployeeKey]) REFERENCES [dbo].[Employee_Dim] ([EmployeeKey]), CONSTRAINT [FK_Sales_Fact_Product_Dim] FOREIGN KEY ([ProductKey]) REFERENCES [dbo].[Product_Dim] ([ProductKey]), CONSTRAINT [FK_Sales_Fact_Shipper_Dim] FOREIGN KEY ([ShipperKey]) REFERENCES [dbo].[Shipper_Dim] ([ShipperKey]), CONSTRAINT [FK_Sales_Fact_Time_Dim] FOREIGN KEY ([TimeKey]) REFERENCES [dbo].[Time_Dim] ([TimeKey]) GO
,
, — ,
. , .
Data Transformation Services Ч
DTS Data Transformation Services (DTS) — , , ,
SQL Server, OLE DB. ,
,
, (
SQL Server).
DTS (DTS package), , , SQL. .). Server Enterprise Manager dtsrun, Services; SQL Server .
( SQL (Meta Data ) DTSSQL DMO — Visual Basic. SQL Server 2000 XML.
DTS-
DTS, Northwind. ,
Northwind_Mart
DTS editor. , Meta Data Service Packages
DTS.
— DTS package SQL Server Enterprise Manager , Data Transformation Services New Package . ,
. DTS
Microsoft OLE DB Provider for SQL Server Data tool . Connection Properties OLE DB, Northwind_Mart, ( , Use Windows NT authentication). NW_OLAP. , DTS , Connection Properties Existing Connection NW_OLAP. — NW
Northwind,
, ,
. Execute SQL Task. Task Properties, (
.
Description (
)
Execute SQL SQL Statement , . 2).
. 2.
Execute SQL Task Properties
, —
. ,
. Ctrl
NW
NW_OLAP. ,
WorkFlow
NW_OLAP,
, . NW
NW_OLAP. , . Э
, .
. precedence constraint),
(
Execute SQL Task
NW, Workflow | On Success. ,
NW
. NW. , ,
.
NW
NW_OLAP,
WorkFlow NW_OLAP —
, .
NW_OLAP, NW,
, , Workflow | On Success.
NW ,
, (
. 3).
. 3.
, .
Time_Dim. ,
. SQL Query Time_Dim:
Description, SQL-
,
SELECT DISTINCT S.ShippedDate AS TheDate, DateName(dw, S.ShippedDate) AS DayOfWeek, DatePart(mm, S.ShippedDate) AS [Month], DatePart(yy, S.ShippedDate) AS [Year], DatePart(qq, S.ShippedDate) AS [Quarter], DatePart(dy, S.ShippedDate) AS DayOfYear, 'N' AS Holiday, case DatePart(dw, S.ShippedDate) when (1) then 'Y' when (7) then 'Y' else 'N' end AS Weekend, DateName(month, S.ShippedDate) + '_' + DateName(year,S.ShippedDate) AS YearMonth, DatePart(wk, S.ShippedDate) AS WeekOfYear FROM Orders S WHERE S.ShippedDate IS NOT NULL
Destination Time_Dim.
Transformations Time_Dim. New, Edit,
, Delete (
. 4).
. 4.
Time_Dim
, Customer_Dim, Customers. Source Customers Northwind, Customer_Dim Customer_Dim. , Region , ). Region , New, New Transformation ActiveX Script ActiveX Script Transformation Properties :
, Table/View, Destination
(
VBScript,
Function Main() If IsNull(DTSSource("Region")) Then DTSDestination("Region") = "Other" Else DTSDestination("Region") = DTSSource("Region") End If Main = DTSTransformStat_OK End Function
, (
. 5).
,
. 5.
Customer_Dim Product_Dim Time_Dim. , Transform Data Task Properties SQL Query, DTS Query Designer ( . 6).
Query
. 6.
, Source Build
DTS Query Designer Products
UnitPrice
Products Destination , ,
Categories ListUnitPrice.
Northwind,
Product_Dim,
SupplierID SupplierName – , (lookup). , SupplierLookup, DTS Query Designer
Products_Dim. , . Lookups,
Add, Query
:
SELECT CompanyName FROM Suppliers WHERE (SupplierID = ?)
Transformations SupplierName. Transformation
SupplierId New
New, ActiveX Script, ActiveX Script Transformation Properties :
VBScript,
Function Main() DTSDestination(“SupplierName”) = _ DTSLookups(“SupplierLookup”).Execute(DTSSource(“SupplierID”).Value) Main = DTSTransformStat_OK End Function
, EmployeeName Transformations, LastName, . Script Transformation Properties:
, Employee_Dim, Customers, FirstName LastName, Customer_Dim. New ActiveX Script , FirstName ActiveX
Function Main() DTSDestination(“EmployeeName”) = DTSSource(“FirstName”) & _ “ “ & DTSSource(“LastName”) Main = DTSTransformStat_OK End Function
, ShipperName
CompanyName Shipper_Dim.
Shipper_Dim Shippers Northwind
, . Sales_Fact,
, :
SELECT Northwind_Mart.dbo.Time_Dim.TimeKey, Northwind_Mart.dbo.Customer_Dim.CustomerKey, Northwind_Mart.dbo.Shipper_Dim.ShipperKey, Northwind_Mart.dbo.Product_Dim.ProductKey, Northwind_Mart.dbo.Employee_Dim.EmployeeKey, Northwind.dbo.Orders.RequiredDate, Orders.Freight * [Order Details].Quantity / (SELECT SUM(Quantity) FROM [Order Details] od WHERE od.OrderID = Orders.OrderID) AS LineItemFreight, [Order Details].UnitPrice * [Order Details].Quantity AS LineItemTotal, [Order Details].Quantity AS LineItemQuantity, [Order Details].Discount * [Order Details].UnitPrice * [Order Details].Quantity AS LineItemDiscount FROM Orders INNER JOIN [Order Details] ON Orders.OrderID = [Order Details].OrderID INNER JOIN Northwind_Mart.dbo.Product_Dim ON [Order Details].ProductID = Northwind_Mart.dbo.Product_Dim.ProductID INNER JOIN Northwind_Mart.dbo.Customer_Dim ON Orders.CustomerID =
Northwind_Mart.dbo.Customer_Dim.CustomerID INNER JOIN Northwind_Mart.dbo.Time_Dim ON Orders.ShippedDate = Northwind_Mart.dbo.Time_Dim.TheDate INNER JOIN Northwind_Mart.dbo.Shipper_Dim ON Orders.ShipVia = Northwind_Mart.dbo.Shipper_Dim.ShipperID INNER JOIN Northwind_Mart.dbo.Employee_Dim ON Orders.EmployeeID = Northwind_Mart.dbo.Employee_Dim.EmployeeID WHERE (Orders.ShippedDate IS NOT NULL)
,
, .
,
В
.
DTS DTS
,
DTS.
Package | Save Package | Execute.
,
.
,
, .
Schedule Package —
Enterprise Manager
. Edit Recurring Job Schedule (
. 7. , Server Agent —
. 7).
DTS ,
,
SQL .
Ч
5. «
/
«
»
-
»
OLAP-
. , OLAP-
Microsoft Analysis Services — .
,
OLAPNorthwind_Mart,
.
Sales_Fact Customer_Dim, Product_Dim, Time_Dim, Shipper_Dim.
, Employee_Dim,
, , .
SQL Server ( , Edition, Standard Edition, Developer Edition Manager,
Microsoft Microsoft SQL Server Enterprise Personal Edition) Analysis . Analysis Manager OLAP-
(
, ),
Register Server… Analysis Manager.
Analysis Servers OLAP,
Connect
. OLAPNew Database…
, ,
, OLAP. Northwind_Mart. Sources New Data Source… Properties: Northwind_Mart ( . 1).
, OLAP-
. , Data Data Link OLE DB Provider for SQL Server
. 1. .
, OLAP. Microsoft SQL Server Analysis Services (shared dimensions) (private dimensions). — . ,
, , . ,
,
. ,
. . , . ,
: .
«
/
» ,
Time_Dim,
(Dimension
wizard).
New Dimension | Wizard Shared Dimensions. .
, « Star Schema: a single dimension table, (
. 2):
. », —
, — Time_Dim,
. 2. , —
«
/
», ,
, .
, OLAP-
,
(
. dimension type «
) Select the
, /
Time Dimension TheDate.
»,
,
,
( , ,
, . Э
, . .),
— . ,
Year, Quarter, Month, Day 1
(
. 3).
. 3.
«
/
»
, dimension).
(changing (
.
Time,
SQL Server 2000) , , .
—
. , , ,
. , Year, Week, Day;
, .
. 4.
, ,
YQMD (
. 4).
— Dimension Editor. , .
of Week, Holiday
, Weekend
,
Member Properties Time_Dim ( . 5).
Day
, Day
. 5. Dimension Editor
,
File | Save,
. , Day,
— Year, Week, Time.YWD.
. Shared Dimensions. Product_Dim. — CategoryName ProductName
New Dimension | Editor Select the dimension table
ProductName — . SupplierName ListUnitPrice. ,
, Advanced
— Properties Product (
. . 6).
. 6.
Dimension Editor
(unbalanced) ,
,
. (ragged) , :
.
— -
,
,
. , ,
: CREATE VIEW dbo.CustomerView_Dim AS SELECT CustomerKey, CustomerID, CompanyName, ContactName, ContactTitle, Address, City, Region, REPLACE(Region, ‘Other’, Country) AS Region1, PostalCode, Country, Phone, Fax FROM dbo.Customer_Dim
Э Region1,
Customer_Dim, «Other»
,
. Э . , CustomerView_Dim
. . Country, Region1, City, CompanyName. Name Contact Name Contact Title.
Member Properties
Company
, Region1.
. Advanced Hide Member If
Properties
Parent’s name. ( . 7).
,
Region1,
. 7. —
«Other»,
, ,
.
«
-
, .
» ,
Employee_Dim
, ,
—
«
-
, Employees Employee_Dim — Reports_To:
» (parent-child). .
Northwind ( .
), ,
ALTER TABLE dbo.Employee_Dim ADD Reports_To int
DTS
Employees (
. 8.
Dimension Wizard. columns in a single dimension table.
. 8).
Employee_Dim Employee_Dim Parent-Child: Two related
Employee_Dim, , Reports_To — Member Name (
. 9.
EmployeeID
Member_Key Parent_Key, EmployeeName —
. 9).
«
-
»
Select advanced options Members with data, Set members with data property — Nonleaf members have associated data Data members are visible. Э , , . , Employee.PC, Hire Date. , . 10.
. 10. И
«
-
»
—
Employee.Regular,
Employee_Name; Hire Date
Reports_To. .
OLAP, . Northwind_Mart
, . New Cube | Wizard
Cubes.
,
,—
.
Sales_Fact. ,
(
, ).
Line Item Total, Line Item Quantity
Line Item Discount (
. 11).
. 11. ,
,
. Employee.PC, Employee.Regular, Time.YQMD, Product Shipper, New Dimension
Customer.
,
.Э
; , (
. 12).
. 12.
—
,
. ,
, . .(
, . 13).
. 13.
, ,
«
».
,
. Analysis
, Services,
,
VBA, Analysis Services).
(
Calculated Members New alculated Member. (Calculated Member Builder), , . , [Measures].[Line Item Discount], Member Name Discounted Total (
, , [Measures].[Line Item Total] , . 14).
. 14. —
,
,
. ,
File | Save
.
—
,
.
,
,
( ). (MOLAP), ,
.
. , —
? ,
— .
, .
, . Storage Design wizard —
. Tools | Design Storage. — MOLAP,
ROLAP
HOLAP (
MOLAP). ( Start
). (
. 15).
,
. 15. .Э
, , . 16).
. 16.
(
Tools | Process Cube,
,
,
(
Data
,
. 17).
. 17. , .Э
, .
Ч
6. Microsoft Excel
OLAPOLAP-
OLAP-
Microsoft Office Microsoft Excel OLAPOLAP-
OLAP-
Microsoft Analysis Services
, Analysis Manager. Э , . Microsoft Office OLAP,
, OLAP-
— )
( — .
OLAP-
—
Microsoft Office,
. OLAP-
—
Microsoft Excel.
OLAP-
Microsoft Office Microsoft Excel
OLAPOLAP.
Microsoft Office,
, ,—
PivotTable. Microsoft Office, PivotTable Service.
, Analysis Services (
OLAP, Analysis Services Microsoft Office). PivotTable Service , Analysis Services . Microsoft Office 2000/XP Analysis Services, Analysis Services, Microsoft
Analysis Services; , PivotTable Service OLAPExcel,
, .
, PivotTable Reports, — ,
,
Excel. Э
OLAP, Microsoft
Excel. PivotTable Reports 5.0,
Excel OLAP-
Services,
OLAP,
, Excel
Analysis Excel 2000. PivotTable
Services. , PivotTable List — Components Web-
,
OLAP, Microsoft Office Web
ActiveX, ,
OLAPWindows.
.
,
OLAP-
Microsoft Office, OLAP-
Microsoft Excel.
OLAP-
Microsoft Excel ,
Microsoft Excel
, OLAP-
.
, . , OLAPOLAP,
Microsoft Excel Microsoft Microsoft SQL Microsoft Excel 2000, . , WebOLE DB.Э .
2000 SQL Server 7.0 OLAP Services. Server 2000 Analysis Services, , OLAP (
7.0),
,
,
Microsoft Excel 2002
.
OLAP,
(
.
5 Data
№ 8’2001). PivotTable and PivotChart Report. PivotTable and PivotChart Wizard.
OLAP-
, Microsoft Excel
,
, External data source. , OLAP Cubes , ,
,
,
(
Get Data Microsoft Query.
. 1).
. 1. , OLE DB— Microsoft OLE DB Provider for OLAP Services 8.0, Microsoft SQL Server 2000 Analysis Services) Connect ( . 2).
(
. 2. Multidimensional Connection , localhost), , OLAPHTTP-
, ,
. 3. ,
( OLAP(
. 3).
OLAP,
OLAP-
(
. 4).
. 4. , (
,
. 5).
. 5. OK. ,
Excel 2000
. 6.
. 6.
Excel 2000
Excel 2000
PivotTable. Excel,
, , . ,
,
( ),
PivotTable
.
Excel 2000
,
,
, . . Excel 2002
PivotTable
—
. (
PivotTable Field List
. 7).
. 7.
Excel 2002 ,
.
( )
Excel 2002 — (Data
Area;
.7
Drop Data Items Here). . 8.
. 8. ,
,
(
). ,
,
, , PivotTable (
, «
»
.
Excel 2002 —
PivotTable Field List) — Row Area, Column Area Page Area.
, . 9.
. 9. ,
Excel .
, ,
OLAP-
.
( ,
drill-down).
A5,
,
. 10.
. 10.
drill-down ,
, ( 11).
,
A4)
PivotTable
. 11. , ; (
. 12).
Show Detail (
.
. 12. , Data. ( . 13).
,
. 13. , PivotTables,
Data
.
,
Excel . , PivotTable | Table Options
PivotTables
Excel
OLAP, .
, —
PivotTable | Field Settings . ,
,
OLAPExcel . PivotTables ,
, ,
(
. 14.
. 14).
OLAP-
,
PivotTable ,
PivotTable FieldList,
drill-down; .
OLAP, Microsoft Excel ,
OLAPOLAP-
*.cub.
.
,
,
,
Microsoft Excel 2002. Microsoft Excel. OLAP-
,
PivotTables 2000 offline data file (
PivotTable | Offline OLAP PivotTable | Client-Server Settings) . 15; Excel 2000 — Create Local Cube).
. 15.
Offline OLAP Settings
Excel 2002 ( Excel Create
, (
,
. 16).
. 16. , ,
, (
,
. 17).
. 17. *.cub. , ,
: Microsoft Excel 2002, Microsoft SQL Server Analysis Services
Microsoft Excel 2000, .
Ч
7.
PivotTable List OLAPWebPivotTable List
Web-
OLAP-
—
Microsoft Excel
OLAP. PivotTable List — Microsoft Office Web Components OLAP. Э , Windows-
OLAPActiveX, Web.
Microsoft Excel 2002,
OLAP-
.
WebMicrosoft Excel File | Save As Web Page,
Web-
. Choose
PivotTable, ( . 1).
Add interactivity with
. 1.
Excel
PivotTable List — Microsoft Excel Publish, Items on Sheet1, — PivotTable functionality
Web-
, ,
.
Microsoft Internet Explorer
Web4.01
,
,
PivotTable List —
ActiveX,
OLAPWindows-
(
Web-
. 2).
. 2. Web-
PivotTable List
, ,
Microsoft Office;
,
Web-
,
,
.
В
PivotTable List ,
PivotTable List. , , , Excel, ( Microsoft Office Web Components Filter Area) c ,
Area 2002. Field List
Windows, Row Area, Column PivotTable Field List Excel
PivotTable List (
. 3.
. 3).
PivotTable Field List
drill-down, «+» (
. 4).
. 4.
Drill-Down
PivotTable Field List
PivotTable List
.
,
-
. 5).
PivotTable Field List Commands and Options ( PivotTable ( , — Top 5, Top 10, Bottom 25
List) . .;
,
,
, Excel (
. 5.
-
. 6).
. 6. — ,
,
, , ,
), Commands and Options (
. 7).
. . (
,
. 7. PivotTable List , (
,
,
), — . (
, Microsoft Office XP). WebOLAP(
Web,
Web,
, , —
,
,
). , WebPivotTable List WebInsert | Web component Spreadsheets and Charts ( . 8).
. 8.
Microsoft FrontPage. ,
FrontPag , Office PivotTable
PivotTable List Microsoft FrontPage
PivotTable List
Web-
,
,
ODBC-
(
,
;
,
). ,
OLAP, ODBC-
Excel ( « »
,
). , PivotTable Field List ( . 9).
. 9.
Web, Web-
PivotTable List Data Source ( FrontPage , Windows). ,
,
Microsoft FrontPage Commands and Options PivotTable List , , , .
—
.
WebMicrosoft Office Web Components , PivotTable List. ChartSpace, Microsoft Office Web Components. Web, FrontPage Insert | Web component Office Chart Spreadsheets and Charts.
.
PivotTable List (
. 10).
. 10.
ChartSpace
.
Commands and Options . , , Excel (
, ),
, OLAP-
. 11. Web-
Web-
Excel (
. 11).
hartSpace . 12.
Microsoft FrontPage
. 12. Web-
PivotTable List ChartSpace Microsoft Internet Explorer OLAPChartSpace. Data Details
(
WebCommands and Options
. 13).
. 13.
ChartSpace
,
WebWeb-
. Excel. PivotTable List,
. , . ActiveX C++, Borland Delphi, Borland C++Builder).
(
PivotTable List ChartSpace , , Microsoft Visual Basic, Microsoft Visual
Ч
8.
MDX
MDX MDX MDX Sample Application MDX OLAPPivotTable List. , Microsoft Office Web Components OLAP,
ActiveX , . .
(
, ,
) (
, ,
-
). ,
OLAP, ).
(
OLAP-
,
Analysis Services,
.
, MDX,
.
MDX MDX (Multidimensional Expressions) — .
Microsoft SQL Server 2000 Analysis Services
MDX .
,
MDX
Services, Э ,
MDX SQL,
MDX
Microsoft SQL Server 2000 Analysis OLE DB for OLAP , , (OLE DB), OLAP. SQL. SQL . , , . Microsoft SQL Server 2000 Analysis Services.
MDX MDX Sample Application MDX MDX Sample Microsoft SQL Server 2000 Analysis Services. Connect, ( Microsoft SQL Server 2000 Analysis Services) — MSOLAP.
Application, ,
O . Connect
— File.
Cancel
MDX.
,
.
MDX Sample
Application
.
Cube . MDX Sample Application
.
MDXQuery),
( .
,
MDXQuery.mdx,
MDXSample. File. MDX-
,
. Syntax Examples. , .
: • • •
Run F5; Run Query
Query; . ,
View | Results, , MDX-
.
MDX Sample Application .
MDX. Э . FoodMart,
Microsoft
SQL Server Analysis Services.
MDX MDX
,
: SELECT [ [, ...]] FROM [] [WHERE []]
: • • •
axis_specification — cube_specification — slicer_specification — MDX
; ; . SELECT .
, SELECT-
:
SELECT FROM Sales
(Unit Sales)
.
, .
:
SELECT {([Measures].[Unit Sales])} ON COLUMNS FROM SALES
SELECT• • • •
:
(
128 ,
,
; ;
.
);
, MDX-
:
SELECT { [Measures].[Unit Sales], [Measures].[Store Sales] } ON COLUMNS, { [Time].[1997], [Time].[1998] } ON ROWS FROM Sales WHERE ( [Store].[USA].[CA] )
SELECT ,
. —
:
—
:
{ [Measures].[Unit Sales], [Measures].[Store Sales] } ON COLUMNS, { [Time].[1997], [Time].[1998] } ON ROWS
FROM .
, —
Sales.
WHERE
, Store. . :
SELECT[Product].[Product Category].Members ON COLUMNS FROM Sales
(1997): SELECT[Product].[Product Category].Members ON COLUMNS, {[Time].[1997]} ON ROWS FROM Sales
: SELECT {([Measures].[Unit Sales])} ON COLUMNS, {[Time].[Quarter].Members} ON ROWS FROM Sales
: SELECT {([Measures].[Unit Sales])} ON COLUMNS, {[Time].[1997].[Q1]} ON ROWS FROM Sales
: SELECT {([Measures].[Unit Sales])} ON COLUMNS, {[Time].[1997].[Q1].[1]} ON ROWS FROM Sales
: SELECT {([Measures].[Unit Sales])} ON COLUMNS, {[Customers].[All Customers].[USA]} ON ROWS FROM Sales
:
.
SELECT {([Measures].[Unit Sales])} ON COLUMNS, {[Customers].[All Customers].[USA].[CA]} ON ROWS FROM Sales
: SELECT {([Measures].[Unit Sales])} ON COLUMNS, {[Product].[Product Family].Members} ON ROWS FROM Sales WHERE [Customers].[All Customers].[USA].[CA]
1997 : SELECT {([Measures].[Unit Sales])} ON COLUMNS, {[Product].[Product Family].Members} ON ROWS FROM Sales WHERE ([Customers].[All Customers].[USA].[CA], [Time].[1997].[Q1])
1997 SELECT {([Measures].[Unit Sales])} ON COLUMNS, {[Product].[Product Department].[Seafood]} ON ROWS FROM Sales WHERE ([Customers].[All Customers].[USA].[CA], [Time].[1997].[Q1])
MDX ,
MDX,
,
.
Array Functions SetToArray Dimension, Hierarchy and Level Functions Dimension
Dimensions
Hierarchy
Level
Levels
IsAncestor
IsEmpty
IsGeneration
IsLeaf
Ancestor
ClosingPeriod
Cousin
CurrentMember
DataMember
DefaultMember
FirstChild
FirstSibling
Ignore
Item
Lag
LastChild
LastSibling
Lead
LinkMember
Members
NextMember
OpeningPeriod
ParallelPeriod
Parent
PrevMember
StrToMember
ValidMeasure
Aggregate
Avg
CalculationCurrentPass CalculationPassValue
CoalesceEmpty
Correlation
Count
Covariance
CovarianceN
DistinctCount
IIf
LinRegIntercept
LinRegPoint
LinRegR2
LinRegSlope
LinRegVariance
LookupCube
Max
Median
Min
Ordinal
Predict
Rank
RollupChildren
Stddev
StddevP
Stdev
StdevP
StrToValue
Sum
Logical Functions Is IsSibling Member Functions
Numeric Functions
:
Value
Var
Variance
VarianceP
VarP
AddCalculatedMembers AllMembers
Ancestors
Ascendants
Axis
BottomCount
BottomPercent
BottomSum
Children
Crossjoin
Descendants
Distinct
DrilldownLevel
DrilldownLevelBottom DrillDownLevelTop
DrilldownMember
DrilldownMemberBottom DrilldownMemberTop DrillupLevel
DrillupMember
Except
Extract
Filter
Generate
Head
Hierarchize
Intersect
LastPeriods
Members
Mtd
NameToSet
NonEmptyCrossjoin
Order
PeriodToDate
Qtd
Siblings
StripCalculatedMembers StrToSet
Subset
Tail
ToggleDrillState
TopCount
TopPercent
TopSum
Union
VisualTotals
Wtd
Ytd
CalculationPassValue
CoalesceEmpty
Generate
IIf
LookupCube
MemberToStr
Name
Properties
SetToStr
TupleToStr
UniqueName
UserName
Set Functions
String Functions
Tuple Functions Current
Item
StrToTuple
Other Functions Call
,
MDX ,
.
MDX (User Defined Functions, UDF), COM DLL.
Server Books Online,
, ,
,
—
«
Microsoft SQL MDX».
Ч
9.
OLAPADOMD
ADO
ADO OLAPMDXADO MD OLAPMDXOLAPVisual Basic for Applications Visual Studio .Net Delphi C++Builder № 11’2001),
( «
MDX»,
, MDX (Multidimensional
OLAPExpressions).
, ,
OLAP6.
,
.
OLAP-
OLAPMicrosoft SQL Server 2000 ADO (ActiveX Data Objects) OLEDB— Microsoft OLE DB Provider for OLAP ADO MD (ADO Multidimensional) — , , ADO, ADO MD.
Analysis Services. Services 8.0. MDX-
Visual Basic .
.
ADO
OLAP-
OLAP-
MDX-
,
, ,
,
,
.
,
,
, ,
. , OLAP—
, (
,
—
) ,
.
,
ADO
— Decision Support Objects (DSO), .
,
ADO MD PivotTabe Services
SQL
Ч , ADO. OpenSchema , OLAP Services (
, ADO Connection,
,— . Э
ADO Recordset,
Microsoft OLE DB Provider for Microsoft OLE DB Provider for OLAP Services 8.0).
OpenSchema
— QueryType, Criteria .
SchemaID, QueryType,
, adSchemaCubes, adSchemaDimensions, adSchemaLevels, adSchemaMembers ADO Recordset , .
6.
adSchemaMeasures, , ,
Visual Basic QueryType
, OpenSchema:
Public ads As Integer
MSHFlexGrid , . Cubes, Dimensions, Levels, Members
OpenSchema, ComboBox, Measures
Click,
List :
Private Sub Combo1_Click() Select Case Combo1.ListIndex Case 0 ads = adSchemaCubes Case 1 ads = adSchemaDimensions Case 2 ads = adSchemaLevels Case 3 ads = adSchemaMembers Case 4 ads = adSchemaMeasures End Select Command1.Enabled = True End Sub
Click
:
Private Sub Command1_Click() Dim RS As New ADODB.Recordset Dim Cnn As New ADODB.Connection Cnn.ConnectionString = "Provider=MSOLAP.2;" & _ "Persist Security Info=True;User ID=sa;Data Source=MAINDESK;" & _ "Initial Catalog=NorthWind_OLAP" Cnn.Open Set RS = CNN.OpenSchema(ads) Set MSHFlexGrid1.Recordset = RS Set CNN = Nothing Set RS = Nothing End Sub
OpenSchema QueryType,
, MSHFlexGrid1 (
. 1).
Connection c ,
. 1.
OpenSchema
ADO
Connection , ADO OpenSchema. .
В
Click
,
MDX.
,
MDXMDXTextBox :
, MDX-
.
Private Sub Command2_Click() Dim RS As New ADODB.Recordset Dim Cnn As New ADODB.Connection On Error GoTo Err1 Cnn.ConnectionString = "Provider=MSOLAP.2;" & _ "Persist Security Info=True;User ID=sa;Data Source=MAINDESK;" & _ "Initial Catalog=NorthWind_OLAP" Cnn.Open Set Rs = Cnn.Execute(Text1.Text) Set MSHFlexGrid1.Recordset = Rs Set Cnn = Nothing Set Rs = Nothing Exit Sub Err1: MsgBox ("Н ") End Sub
Execute ADO Connection.
. 2.
. 2.
MDX-
Execute
ADO
Connection ,
Execute
ADO Connection , . ,
MDX, :
SELECT measures.members ON columns, product.children ON rows, shipper.children ON pages FROM sales
,
ADO
Recordset, ( . 3).
. 3.
MDX-
, OLAP-
Microsoft Excel ConnectionString Connecton
,
*.cub. :
Cnn.ConnectionString = ”Provider=MSOLAP.2;Data Source=C:\Data\Cubes\NW1.cub”
, . ,—
OLAP, ADO MD.
— OLAP.
ADO MD
OLAP-
ADO MD —
ADO, , MDX-
,
msadomd.dll
.
ADO MD,
. 4,
«
» ,
OLAP-
.
. 4.
ADO MD
ADO MD , , .
,
Catalog, ,
CubeDef Dimension. ,
CubeDefs. CubeDef. Dimensions, , Name.
Dimension,
Dimension
Hierarchies, Hierarchy. Hierarchy
,
Levels, ,
Level. Level
.
Catalog CubeDef, Name
—
Members,
Member.
Ч Visual Basic 6,
, ADO MD.
TreeView
, TreeView
: —
Click (
.
1 Private Sub Command1_Click() Dim Nod, Nod1 As Node, i, j, k, l As Integer Dim Cat As New ADOMD.Catalog Dim Cnn As New ADODB.Connection
, 1).
Cnn.ConnectionString = "Provider=MSOLAP.2;Persist Security Info=True;”_ +”User ID=sa;Data Source=MAINDESK;Initial Catalog=NorthWind_OLAP" Cnn.Open Set Cat.ActiveConnection = Cnn If Cat.CubeDefs.Count > 0 Then Set Nod = TreeView1.Nodes.Add(, , "Catalog", "Catalog") For i = 0 To Cat.CubeDefs.Count - 1 Set Nod1 = TreeView1.Nodes.Add("Catalog", tvwChild, _ Cat.CubeDefs(i).Name, Cat.CubeDefs(i).Name) For j = 0 To Cat.CubeDefs(i).Dimensions.Count - 1 Set Nod1 = TreeView1.Nodes.Add(Cat.CubeDefs(i).Name, tvwChild, _ Cat.CubeDefs(i).Dimensions(j).UniqueName, _ Cat.CubeDefs(i).Dimensions(j).UniqueName) For k = 0 To (Cat.CubeDefs(i).Dimensions(j).Hierarchies.Count - 1) For l = 0 To _ (Cat.CubeDefs(i).Dimensions(j).Hierarchies(k).Levels.Count - 1) Set Nod1 = _ TreeView1.Nodes.Add(Cat.CubeDefs(i).Dimensions(j).UniqueName,_ tvwChild, _ Cat.CubeDefs(i).Dimensions(j).Hierarchies(k).Levels(l).UniqueName,_ Cat.CubeDefs(i).Dimensions(j).Hierarchies(k).Levels(l).UniqueName) Next l Next k Next j Next i Command1.Enabled = False End If End Sub
. 5.
. 5.
ADO MD —
ADO MD.
MDX-
В
MDXADO MD
Э
MDXCells,
, CellSet
.
Axes,
.
CellSet.
Axis ( ). Position, Members,
Positions, Position
Cell,
Axis
. MDX. TextBox
, Click
(
.
2).
2 Private Sub Command2_Click() Dim Cst As New ADOMD.Cellset Dim Cnn As New ADODB.Connection Cnn.ConnectionString = "Provider=MSOLAP.2;Persist Security Info=True;”_ +”User ID=sa;Data Source=MAINDESK;Initial Catalog=NorthWind_OLAP" Cnn.Open Text2.Text = vbTab & vbTab Set cst.ActiveConnection = cnn cst.Source = Text1.Text On Error GoTo Err cst.Open For i = 0 To cst.Axes(0).Positions.Count - 1 Text2.Text = Text2.Text & cst.Axes(0).Positions(i).Members(0).Caption_ & vbTab Next i Text2.Text = Text2.Text & vbCrLf & vbCrLf For j = 0 To cst.Axes(1).Positions.Count - 1 Text2.Text = Text2.Text & cst.Axes(1).Positions(j).Members(0).Caption_ & vbTab For k = 0 To cst.Axes(0).Positions.Count - 1 Text2.Text = Text2.Text & vbTab & cst(k, j).FormattedValue Next k Text2.Text = Text2.Text & vbCrLf Next j Exit Sub Err: MsgBox ("Invalid Query") End Sub
CellSet MDX-
,
CellSet Text2.
. 6.
Open.
. 6.
MDX-
ADO MD
:
,
Cellset
. , OLAP-
.
OLAPVisual Basic for Applications , Access TextBox —
ADO,
Access VBA, (
Access
,
,
RichEdit Control). MS Office,
, :
Dim cnnConn, rs As Object Set cnnConn = CreateObject("ADODB.Connection") Cnn.ConnectionString = "Provider=MSOLAP.2;Persist Security Info=True;”_ +”User ID=sa;Data Source=MAINDESK;Initial Catalog=NorthWind_OLAP" Source=e:\old_data\d\whistler\sales.cub" cnnConn.Open Set rs = CreateObject("ADODB.Recordset") Set rs = cnnConn.OpenSchema(ads)
,
ADO MD, .
VBA
Visual Studio .Net Visual Studio .Net
COM
ADO,
, Basic .Net,
ADO,
Visual
ADO MD, .
ADO .Net, ADO.Net,
,
GetOleDbSchemaTable, Visual Studio .Net Beta 2
OpenSchema, ,
,
.
MDX, OleDbConnection OleDbCommand. ADO .Net,
Delphi
, .
C++Builder ,
,
Enterprise
5. OpenSchema
TADOConnection:
procedure TForm1.Button1Click(Sender: TObject); var SI : TSchemaInfo; I : Integer; begin case ComboBox1.ItemIndex of 0: SI := siCubes; 1: SI := siDimensions; 2: SI := siHierarchies; 3: SI := siLevels; 4: SI := siMeasures; 5: SI := siProperties; 6: SI := siMembers; end; ADOConnection1.OpenSchema(SI,EmptyParam, EmptyParam,ADODataSet1); ADODataSet1.Open; end;
Open TADODataSet: procedure TForm1.Button1Click(Sender: TObject); var i:integer; begin If Memo1.Lines.Count > 0 Then try With ADOQuery1 do begin Close; SQL := Memo1.Lines; Open; end; except ShowMessage('Invalid MDX query'); end; end;
OLAPCOM-
ADO MD , 3.0.
Ч
10
PivotTable Service OLAP-
Microsoft PivotTable Service DDL DML CREATE CUBE INSERT INTO Source_DSN, Data Source Provider OLAP, PivotTable Service OLAPVisual Basic 6 . OLAPMicrosoft SQL Server 2000 Analysis Services: , ADO (ActiveX Data Objects) Microsoft OLE DB Provider for OLAP , ADO MD (ADO Multidimensional).
Services 8.0, ,
OLAPExcel
PivotTable List .
ChartSpace ( № 9, 10’2001).
; ,
,
,
Microsoft Office , , Microsoft Office
Excel, — OLAP-
OLAP-
. Э
OLAP.
Office Web Components .
—
. Microsoft PivotTable Service, Decision Support Objects.
,
OLAP—
OLAP-
Microsoft PivotTable Service Microsoft PivotTable Service OLE DB for OLAP,
OLE DBAnalysis Services
PivotTable Service .Э , Service SQL, SQL — DDL (Data Definition Language) OLAP-
OLAP-
, Analysis Services, . , , OLAP-
PivotTable
Multidimensional
Expressions
. (MDX)
DML (Data Manipulation Language), . .
PivotTable Service OLAPAnalysis Services,
, ,
,
,
. TCP/IP
Analysis Services
, HTTP.
Microsoft PivotTable Service Microsoft PivotTable Service Services. ,
Microsoft SQL Server 2000 Analysis , Microsoft Office ( , Microsoft Excel), Analysis Services, Microsoft Excel .
. PivotTable Service
Microsoft PivotTable Service COMBorland Delphi, Borland C++Builder.
DDL
,
, Visual Basic, Microsoft Visual C++,
DML
Microsoft PivotTable Service, , . , PivotTable Service CreateCube, , ( Service InsertInto, INSERT INTO), .
CREATE CUBE Э
DDL, .
SQL Server Books Online, : CREATE CUBE ( DIMENSION [TYPE ] LEVEL [TYPE ], [LEVEL [TYPE ]…], [[DIMENSION [TYPE ] LEVEL [TYPE ,
OLAPDDL
DML ( CREATE CUBE), PivotTable ,
[LEVEL >[TYPE …],…], MEASURE FUNCTION , [MEASURE FUNCTION ,…] )
,
NorthWind, Microsoft SQL Server,
CREATE CUBE: CREATE CUBE Sales( DIMENSION [Country], LEVEL [All] TYPE ALL, LEVEL [Country], LEVEL [City], LEVEL [CustomerID], DIMENSION [Salesperson], LEVEL [All] TYPE ALL, LEVEL [Salesperson], DIMENSION [ShipperName], LEVEL [All] TYPE ALL, LEVEL [ShipperName], DIMENSION [CategoryName],LEVEL [All] TYPE ALL, LEVEL [CategoryName], LEVEL [ProductName], DIMENSION [OrderDate] TYPE TIME, LEVEL [All] TYPE ALL, LEVEL [Year] TYPE YEAR, LEVEL [Quarter] TYPE QUARTER, LEVEL [Month] TYPE MONTH, LEVEL [Day] TYPE DAY, MEASURE [Sum Of ExtendedPrice] FUNCTION SUM, MEASURE [Sum Of Quantity] FUNCTION SUM
INSERT INTO Э
DML, .
SQL Server Books Online.
:
InsertInto=INSERT INTO ( ., [.,…] , [,… ] ) OPTIONS SELECT FROM