none
The OLE DB provider "MSOLAP" for linked server "Linked Server Name" supplied inconsistent metadata for a column. The name was changed at execution time.

    Question

  • Hi,

    When i execute below query in MDX window , Query executed successfully and i got correct output .

    With

    Member P1  As Sum([Measures].[ExpectedCount] ,( [TblPass].[TblPass].&[1],[TblStatus].[TblStatus].&[1]))
    MEMBER P2  As Sum([Measures].[ExpectedCount] ,( [TblPass].[TblPass].&[2]))

    SELECT
    NON EMPTY
        {
            P1,P2,[Measures].[Expected Count]
        }
    ON COLUMNS
    FROM [cube_Class]

    but when same MDX query in openquery method using  relational (SQL) window . i got error "The OLE DB provider "MSOLAP" for linked server "Linked Server Name" supplied inconsistent metadata for a column. The name was changed at execution time."

    Select * From OpenQuery
    (LinkedClass,
    '

    With

    Member P1  As Sum([Measures].[ExpectedCount] ,( [TblPass].[TblPass].&[1],[TblStatus].[TblStatus].&[1]))
    MEMBER P2  As Sum([Measures].[ExpectedCount] ,( [TblPass].[TblPass].&[2]))

    SELECT
    NON EMPTY
        {
            P1,P2,[Measures].[Expected Count]
        }
    ON COLUMNS
    FROM [cube_Class]

    ')

    I would be appreciate for any help .

    Thanks in advance !


    Prashant Mhaske

    Wednesday, February 29, 2012 8:01 AM

Answers

  • Hi Prashant

    The thing you don't have admin access to create linked server. Try below  sp_addlinkedserver.

    EXEC sp_addlinkedserver
    @server='TestTest',
    @srvproduct='',
    @provider='MSOLAP',
    @datasrc='localhost',
    @catalog='Cap'  
    Declare @MDXExpression as Varchar(MAX)
    Select @MDXExpression = '
    						With
    						Member P1  As Sum([Measures].[ExpectedCount] ,( [TblPass].[TblPass].&[1],[TblStatus].[TblStatus].&[1]))
    						MEMBER P2  As Sum([Measures].[ExpectedCount] ,( [TblPass].[TblPass].&[2]))
    						SELECT 
    						NON EMPTY
    							{
    								P1,P2,[Measures].[Expected Count]
    							}
    						ON COLUMNS
    						FROM [cube_Class]
    						';						
    Exec ('SELECT * INTO ##TestTemp FROM OpenQuery(TestTest,''' + @MDXExpression + ''')')
    SELECT 
    	*
    from 
    	##TestTemp t
    --Drop table ##TestTemp;

    Suhas_Akole

    Mark as Answer if this resolves your problem or "Vote as Helpful" if you find it helpful.

    • Marked as answer by PrashantMhaske Wednesday, February 29, 2012 1:04 PM
    Wednesday, February 29, 2012 8:37 AM