SQL Server 2008 R2


  This feature will be removed in the next version of Microsoft SQL Server. Do not use this feature in new development work, and modify applications that currently use this feature as soon as possible.

A Decision Support Objects (DSO) object of ClassType clsCubeAnalyzer contains a single method used to extract information from the query log. The query log stores the descriptions of queries executed on the Analysis server. This object provides a method through its own internal interface.

There are no collections or properties associated with an object of ClassType clsCubeAnalyzer.

Retrieving the Cube Query Log

The following code example retrieves the entire contents of a cube's query log from the Analysis server and prints the number of records in the immediate window:

Option Explicit

Public dsoServer As DSO.Server
Public dsoDB As DSO.MDStore
Public dsoCube As DSO.MDStore
Public dsoCubeAnalyzer As DSO.CubeAnalyzer
Public ADODBRecSet As ADODB.Recordset

Public Sub AnalyzeCube()
    If dsoServer Is Nothing Then
       Set dsoServer = New DSO.Server
         'MyServer is the name of the Analysis server.
         dsoServer.Connect ("MyServer")
    End If
    'Get first database from server.
    Set dsoDB = dsoServer.MDStores(1)
    'Get first cube from database.
    Set dsoCube = dsoDB.MDStores(1)
    'Get analyzer object from cube.
    Set dsoCubeAnalyzer = dsoCube.Analyzer
    'Get recordset from log.
    Set ADODBRecSet = dsoCubeAnalyzer.OpenQueryLogRecordset _
      ("SELECT * FROM QueryLog")
    If ADODBRecSet.BOF And ADODBRecSet.EOF Then
        Debug.Print "<<No records in query log>>"
       Debug.Print "   Record count: " & ADODBRecSet.RecordCount
    End If
End Sub

Community Additions