arm77

PI OLEDB ENTERPRISE - AF LINKED SERVER - SQL Query Error

Discussion created by arm77 on Nov 22, 2011
Latest reply on Nov 22, 2011 by aabrodskiy

Hi,

 

We have created a linked server to an AF server using the PI OLEDB Enterprise 2010. But, when i execute the below query, we get some errors:

 

  select * from openquery(<Linked server name>,
  'SELECT * FROM NIBRAS.ASSET.ELEMENTATTRIBUTE EA WHERE EA.NAME=N''Water Volume''')

 

we get the below error message:

 

OLE DB provider "PIOLEDBENT" for linked server "MUS-AS-104" returned message "[Nibras.Asset.ElementAttribute EA] 'ElementID' column is not restricted. Such a query is considered expensive.

Possible solutions:
- Add a join with 'ElementHierarchy' or 'Element' table or, if the join is already present, reorder tables in the FROM clause and use the 'OPTION (FORCE ORDER)' query hint.
- Add 'OPTION (ALLOW EXPENSIVE)' query hint.".
Msg 7320, Level 16, State 2, Line 1
Cannot execute the query "SELECT * FROM NIBRAS.ASSET.ELEMENTATTRIBUTE EA WHERE EA.NAME=N'Water Volume'" against OLE DB provider "PIOLEDBENT" for linked server "MUS-AS-104".

 

this is the same case for all the queries.

Outcomes