Linking the AVEVA historian OLE DB provider to the microsoft SQL server
- Last UpdatedMar 19, 2025
- 1 minute read
Because the AVEVA Historian OLE DB provider retrieves data from the history blocks and presents it to Microsoft SQL Server as a table, it can be thought of as a type of server. The AVEVA Historian OLE DB provider must be added to the Microsoft SQL Server as a "linked" server before it can be used to process queries.
This linking is performed automatically during the AVEVA Historian installation. If, for some reason, you need to re-link the AVEVA Historian OLE DB provider to the Microsoft SQL Server, the statements for linking are as follows:
sp_addlinkedserver
@server = 'INSQL',
@srvproduct = '',
@provider = 'INSQL'
go
sp_serveroption 'INSQL','collation compatible',true
go
sp_addlinkedsrvlogin 'INSQL','TRUE',NULL,NULL,NULL
go
"INSQL" is the name of the AVEVA Historian OLE DB provider as the linked server. Use this name to specify the AVEVA Historian OLE DB provider in a query.
To perform joins between the legacy analog history tables and discrete history tables, the installation program also creates an alias for the same AVEVA Historian OLE DB provider:
sp_addlinkedserver
@server = 'INSQLD',
@srvproduct = '',
@provider = 'INSQL'
go
sp_serveroption 'INSQLD','collation compatible',true
go
sp_addlinkedsrvlogin 'INSQLD','TRUE',NULL,NULL,NULL
go
For example, if you want to execute a query that performs this type of join, use the normal alias in specifying the first table (the analog history table), and use the second alias in specifying the second table (the discrete history table, hence the "D" added to the alias name).