Database Journal
MS SQL Oracle DB2 Access MySQL PostgreSQL Sybase PHP SQL Etc SQL Scripts & Samples Links Database Forum

» Database Journal Home
» Database Articles
» Database Tutorials
MS SQL
Oracle
DB2
MS Access
MySQL
» RESOURCES
Database Tools
SQL Scripts & Samples
Links
» Database Forum
» Sitemap
Free Newsletters:
DatabaseDaily  
News Via RSS Feed


follow us on Twitter
Database Journal |DBA Support |SQLCourse |SQLCourse2
 

Featured Database Articles

MS SQL

Posted Nov 1, 1999

DSOCtrl Overview - Page 3

By Darren Green

Overview | Reference | Examples

The first few examples are for Visual Basic and are designed to show the ways in which the component can be used. All examples are based on a local server with the Foodmart sample OLAP database. To use VBScript instead, substitue Dim objDSOCtrl As New DSOCtrl.OLAPProc for Set objDSOCtrl = CreateObject("DSOCtrl.OLAPProc"). Remember to declare objDSOCtrl, and change the process type to a numeric, as the constants will be unavailable.


VB 1:
Perform a default cube process, as no ProcessType is specified, and return the time taken.

Dim objDSOCtrl As New DSOCtrl.OLAPProc
objDSOCtrl.ProcessCube ".", "FoodMart", "Sales"
MsgBox objDSOCtrl.ProcessDuration


VB 2:
Assign properties individually and perform a default cube process.

Dim objDSOCtrl As New DSOCtrl.OLAPProc
objDSOCtrl.Server = "."
objDSOCtrl.Database = "FoodMart"
objDSOCtrl.Cube = "Sales"
objDSOCtrl.ProcessType = processDefault
objDSOCtrl.ProcessCube


VB 3:
Use the ConnectCube method and return the last processed. Then process the cube and return the date again, and the time taken.

Dim objDSOCtrl As New DSOCtrl.OLAPProc
objDSOCtrl.ConnectCube ".", "FoodMart", "Sales"
MsgBox objDSOCtrl.LastProcessed
objDSOCtrl.ProcessCube , , , processFull
MsgBox objDSOCtrl.LastProcessed
MsgBox objDSOCtrl.ProcessDuration


T-SQL:

I have created a two stored procedure samples as wrappers around the sp_OAxxxx code required to utilise DSOCtrl. Both require the two OLE Automation Return Codes and Error Information stored procedures detailed in SQL Server Books Online (msoleerror.sql)

sp_DSOCtrl_ProcessCube (spDSOCtrlProcessCube.sql)
This example will process the cube Sales in the FoodMart DB on the local server.

EXEC master.dbo.sp_DSOCtrl_ProcessCube ".", "FoodMart", "Sales"

sp_DSOCtrl_ProcessAllDimensions (spDSOCtrlProcessAllDimensions.sql)
This example will process all dimensions in the FoodMart DB on the local server. The process duration is returned as an output parameter and printed.

DECLARE @ProcessDuration datetime
 EXEC master.dbo.sp_DSOCtrl_ProcessAllDimensions ".", "FoodMart",
   @ProcessDuration OUTPUT
 PRINT CONVERT(char(8), @ProcessDuration, 108)


MS SQL Archives

Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 




Latest Forum Threads
MS SQL Forum
Topic By Replies Updated
SQL 2005: SSIS: Error using SQL Server credentials poverty 3 August 17th, 07:43 AM
Need help changing table contents nkawtg 1 August 17th, 03:02 AM
SQL Server Memory confifuration bhosalenarayan 2 August 14th, 05:33 AM
SQL Server Primary Key and a Unique Key katty.jonh 2 July 25th, 10:36 AM