dbTalk Databases Forums  

DataSet Decoding

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss DataSet Decoding in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
sshaahin
 
Posts: n/a

Default DataSet Decoding - 11-09-2005 , 01:16 PM






Hi,

We are using the following function to decode the DataSet values in olap log:

CREATE function dbo.fn_resolve_dataset (@ServerName sysname, @DatabaseName
sysname, @CubeName sysname, @DataSet varchar(255))
returns varchar(7000)
as
begin

declare @dso_server int
declare @dso_database int
declare @dso_cube int

declare @number_of_dimensions int
declare @dimension_name varchar(255)
declare @level_name varchar(255)
declare @return_value sysname
set @return_value = ''
declare @method_name sysname

declare @itmp tinyint

declare @hr int

EXEC @hr = sp_OACreate 'DSO.Server', @dso_server OUT
IF @hr <> 0 GOTO ObjectError

EXEC @hr = sp_OAMethod @dso_server, 'Connect', null, @ServerName
IF @hr <> 0 GOTO ObjectError

EXEC @hr = sp_OAMethod @dso_server, 'MDStores.Item', @dso_database out,
@DatabaseName
IF @hr <> 0 GOTO ObjectError

EXEC @hr = sp_OAMethod @dso_database, 'Cubes.Item', @dso_cube out, @CubeName
IF @hr <> 0 GOTO ObjectError

EXEC @hr = sp_OAMethod @dso_cube, 'MDStores(1).Dimensions.Count',
@number_of_dimensions out
IF @hr <> 0 GOTO ObjectError

set @itmp = 1
while @itmp <= @number_of_dimensions
begin

if substring(@DataSet, @iTmp, 1) <> '1'
begin
set @method_name = 'MDStores(1).Dimensions(' + convert(varchar, @itmp) +
').Name'
EXEC @hr = sp_OAGetProperty @dso_cube, @method_name, @dimension_name out
iF @hr <> 0 GOTO ObjectError

set @method_name = 'MDStores(1).Dimensions(' + convert(varchar, @itmp) +
').Levels(' + substring(@DataSet, @iTmp, 1) + ').Name'
EXEC @hr = sp_OAGetProperty @dso_cube, @method_name, @level_name out
iF @hr <> 0 GOTO ObjectError

set @return_value = @return_value + @dimension_name + '.' + @level_name
+ ';'


end

set @itmp = @itmp + 1
end

EXEC @hr = sp_OADestroy @dso_cube
IF @hr <> 0 GOTO ObjectError

EXEC @hr = sp_OADestroy @dso_database
IF @hr <> 0 GOTO ObjectError

EXEC @hr = sp_OAMethod @dso_server, 'CloseServer'
IF @hr <> 0 GOTO ObjectError

EXEC @hr = sp_OADestroy @dso_server
IF @hr <> 0 GOTO ObjectError


return @return_value

ObjectError:
RETURN 1
end


The connect statement EXEC @hr = sp_OAMethod @dso_server, 'Connect', null,
@ServerName

fails with return value of 1.

We are using Windows authentication and the function is called from an sa
machine with supposedly full permission.

What could be the possible causes?

Thank you for your help.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.