AnsweredAssumed Answered

OLEDB - Asset Framework

Question asked by jrheeders on Oct 24, 2018
Latest reply on Oct 24, 2018 by csawyer

Good day,

Can somebody guide me in the right direction. I am not familiar with OLEDB with Asset Framework and want to get familiar with it. I found some examples under PI SQL Commander\MyProjects\PI SQL Query Compendium. I installed the NuGreen and PiOleDbTest databases and generated events. But when I try to run the SQL queries I am just getting errors the whole time.


Error from PI SQL Commander:

[\\WIN-9TFL7DK8HKH\NuGreen\NuGreen\Houston\Cracking Process\Equipment\P-214|Motor Amps] [OSIsoft.AFSDK] [-10734] PINET: Broken Connection.


Error from MSSQL using the linked connection:

OLE DB provider "PIOLEDBENT" for linked server "LINKEDAF" returned message "[NuGreen.Data.Snapshot Tbl1005] Neither 'ElementAttributeID' nor 'ElementTemplateAttributeID' column is restricted. Such a query is considered expensive.



Possible solutions:

- Add a join with 'ElementAttribute' or 'vElementAttribute' or 'ElementTemplateAttribute' 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 2

Cannot execute the query "SELECT "Col1030","Col1027","Tbl1005"."Time" "Col1022","Tbl1005"."Value" "Col1023" FROM "NuGreen"."Data"."Snapshot" "Tbl1005",(SELECT "Col1029","Col1030","Col1031","Tbl1003"."ID" "Col1026","Tbl1003"."Name" "Col1027","Tbl1003"."ElementID" "Col1024" FROM "NuGreen"."Asset"."ElementAttribute" "Tbl1003",(SELECT "Tbl1001"."Path" "Col1029","Tbl1001"."Name" "Col1030","Tbl1001"."ElementID" "Col1031" FROM "NuGreen"."Asset"."ElementHierarchy" "Tbl1001" WHERE "Tbl1001"."Path"='\NuGreen\Houston\Cracking Process\Equipment\') Qry1032 WHERE "Col1031"="Tbl1003"."ElementID") Qry1033 WHERE "Tbl1005"."ElementAttributeID"="Col1026"" against OLE DB provider "PIOLEDBENT" for linked server "LINKEDAF".


Is there maybe a proper document that I can follow. Some guidance would be appreciated. Thanks!