Showing posts with label openquery. Show all posts
Showing posts with label openquery. Show all posts

Thursday, March 8, 2012

Call to Analysis Services via SQL CLR?

I'm trying to query Analysis Services 2000/2005 from SQL Server 2005 without using a Linked Server or OPENQUERY. My thoughts were I could create a .NET assembly that accepts a server name, and mdx to execute, and return the data to SQL Server. Has anyone tried this or is this possible?Thats sure possible e.g. with the oledbconenction object, but you will have to keep in mind that this will the EXTERNAL access and therefore your permission set of the assembly has to be set to this level.

Jens K. Suessmeyer.

http://www.sqlserver2005.de

Saturday, February 25, 2012

call a UDF from another server <> Authentication

Hello

I'm trying to call a UDF from another server with the following command:

select i from openquery([10.0.10.240], '[survey].[dbo].[ufnGetAxis_Ana] as i')

error:

[OLE/DB provider returned message: Invalid authorization specification]

OLE DB error trace [OLE/DB Provider 'SQLOLEDB' IDBInitialize::Initialize returned 0x80040e4d: Authentication failed.].

Msg 7399, Level 16, State 1, Line 3

OLE DB provider 'SQLOLEDB' reported an error. Authentication failed.

Can someone give me some advice on how to pass username and password to access an object on another server?

Many thanks!

hi, first thing is it the SQL Server or other one?

if it is SQL Server, then it quit easy, you need to create a Linked Server(Direct IP Address will not work) using

sp_addlinkedserver [ @.server= ] 'server' [ , [ @.srvproduct= ] 'product_name' ]

[ , [ @.provider= ] 'provider_name' ]

[ , [ @.datasrc= ] 'data_source' ]

[ , [ @.location= ] 'location' ]

[ , [ @.provstr= ] 'provider_string' ]

[ , [ @.catalog= ] 'catalog' ] then use the openquery asOPENQUERY ( linked_server ,'query' )

linked_server

Is an identifier representing the name of the linked server.

'query'

Is the query string executed in the linked server. The maximum length of the string is 8 KB

now try

select i from openquery(<linked server name>, '[survey].[dbo].[ufnGetAxis_Ana] as i')

Regards,

Thanks.

Gurpreet S. Gill

|||

Many thanks Gurpreet

Are you sure about the syntax?
I get a syntax error when executing select i from openquery(myserver,'survey.dbo.ufnGetAxis_Ana(2,7) as i')

Many thanks!

Worf

|||

hi try this

select i FROM openquery(ha9,'select pubs.dbo.myFunction() as i')

this is the command, where 'ha9' is linked server , at the remote end 'pubs' is the database name, 'dbo' is owner and 'myFunction' is the name of the function, in your case it should be

select i from openquery(myserver,'select survey.dbo.ufnGetAxis_Ana(2,7) as i')

NOTE: if your Remote Serever is SQL Server, then , name of the server is the Linked server name, also need to set the login & password.

Regards,

Thanks.

Gurpreet S. Gill

|||

It works Gurpreet!!

Many many thanks!!!

Worf

Friday, February 10, 2012

calculated members from a cube using the OPENQUERY

We have a DTS package that runs once a month. It has been working for more than four years now, but all of the sudden it started to fail. The package starts with loading data from an sql database and then updating the cube and then send the calculated results to a SQL2000 server table.

the problem starts at the last part when reading from cube into sql2000 table. below is my select which fails:

select

convert(decimal(18,2), replace("[Measures].[Sales]", ',', '.')),

convert(decimal(18,2), replace("[Measures].[Cost]", ',', '.')),

convert(decimal(18,2), replace("[Measures].[Hours A1]", ',', '.')),

convert(decimal(18,2), replace("[Measures].[Data]", ',', '.'))

convert(decimal(18,2), replace("[Measures].[Orderlines A3]", ',', '.')),

convert(decimal(18,2), replace("[Measures].[Invoices E3]", ',', '.'))

from openquery

( GONS021_OLAP, 'select

{[Measures].[Sales], [Measures].[Cost], [Measures].[TB], [Measures].[TG], [Measures].M1, [Measures].[M2], [Measures].[A1], [Measures].[A2], [Measures].[A3], [Measures].[A4], [Measures].[A5], [Measures].[A6], [Measures].[A7], [Measures].[A8],[Measures].[T1], [Measures].[L1], [Measures].[L2], [Measures].[L3], [Measures].[E1], [Measures].[E2], [Measures].[E3], [Measures].[E4], [Measures].[E5],[Measures].[Hours A1],[Measures].[Data],[Measures].[Orderlines A3],[Measures].[Qty Returned A8],[Measures].[Invoices E3] } on columns,

{[Customer].[All Customer], [Customer].[Customer No].Members} on rows

from TotalTable where ([Time].&[2007])')

The error message:

The MDX queries executed through the OPENQUERY function returns the following error messages for some members of the dimension used to construct them:

Could not get the data of the row from the OLE DB provider 'MSOLAP'.

OLE DB error trace [OLE/DB Provider 'MSOLAP' IRowset::GetData returned 0x80040e21:Data status returned from the provider: [COLUMN_NAME=[Measures].[Data] STATUS=DBSTATUS_E_UNAVAILABLE], [COLUMN_NAME=[Measures].[Invoices E3] STATUS=DBSTATUS_E_UNAVAILABLE]]

The same MDX Queries execute without any problems through the MDX Sample

Application!

OBS: I have SP4 on both SQL and Analysis

Hi there i am wondering if you managed to solve this, as I had exactly the same problem? A query that worked previously, is now not working. I am also on SQL Server 2000 Analysis SP 4

calculated members from a cube using the OPENQUERY

We have a DTS package that runs once a month. It has been working for more than four years now, but all of the sudden it started to fail. The package starts with loading data from an sql database and then updating the cube and then send the calculated results to a SQL2000 server table.

the problem starts at the last part when reading from cube into sql2000 table. below is my select which fails:

select

convert(decimal(18,2), replace("[Measures].[Sales]", ',', '.')),

convert(decimal(18,2), replace("[Measures].[Cost]", ',', '.')),

convert(decimal(18,2), replace("[Measures].[Hours A1]", ',', '.')),

convert(decimal(18,2), replace("[Measures].[Data]", ',', '.'))

convert(decimal(18,2), replace("[Measures].[Orderlines A3]", ',', '.')),

convert(decimal(18,2), replace("[Measures].[Invoices E3]", ',', '.'))

from openquery

( GONS021_OLAP, 'select

{[Measures].[Sales], [Measures].[Cost], [Measures].[TB], [Measures].[TG], [Measures].M1, [Measures].[M2], [Measures].[A1], [Measures].[A2], [Measures].[A3], [Measures].[A4], [Measures].[A5], [Measures].[A6], [Measures].[A7], [Measures].[A8],[Measures].[T1], [Measures].[L1], [Measures].[L2], [Measures].[L3], [Measures].[E1], [Measures].[E2], [Measures].[E3], [Measures].[E4], [Measures].[E5],[Measures].[Hours A1],[Measures].[Data],[Measures].[Orderlines A3],[Measures].[Qty Returned A8],[Measures].[Invoices E3] } on columns,

{[Customer].[All Customer], [Customer].[Customer No].Members} on rows

from TotalTable where ([Time].&[2007])')

The error message:

The MDX queries executed through the OPENQUERY function returns the following error messages for some members of the dimension used to construct them:

Could not get the data of the row from the OLE DB provider 'MSOLAP'.

OLE DB error trace [OLE/DB Provider 'MSOLAP' IRowset::GetData returned 0x80040e21:Data status returned from the provider: [COLUMN_NAME=[Measures].[Data] STATUS=DBSTATUS_E_UNAVAILABLE], [COLUMN_NAME=[Measures].[Invoices E3] STATUS=DBSTATUS_E_UNAVAILABLE]]

The same MDX Queries execute without any problems through the MDX Sample

Application!

OBS: I have SP4 on both SQL and Analysis

Hi there i am wondering if you managed to solve this, as I had exactly the same problem? A query that worked previously, is now not working. I am also on SQL Server 2000 Analysis SP 4