Querying the WideHistory table
- Last UpdatedMar 20, 2025
- 1 minute read
The wide extension table is a transposition of the History table. Use the wide history tables any time you want to find the value of one or more tags over time and need to specify different filter criteria for each tag.
For more information, see History Tables and Views in the AVEVA Historian Database Reference.
The following query returns the value of two tags from the WideHistory table. The WideHistory table can only be accessed using the OPENQUERY function. The "Runtime.dbo." qualifier is optional.
SELECT * FROM OpenQuery(INSQL,'
SELECT DateTime, ReactLevel, ReactTemp
FROM Runtime.dbo.WideHistory
WHERE Reactlevel > 1500
AND ReactTemp > 150
')
The results are:
|
DateTime |
ReactLevel |
ReactTemp |
|
2001-03-02 06:20:00.000 |
1865.0 |
191.3 |
|
2001-03-02 06:21:00.000 |
2025.0 |
195.9 |
|
2001-03-02 06:22:00.000 |
2000.0 |
195.9 |
|
2001-03-02 06:23:00.000 |
2025.0 |
180.9 |
|
2001-03-02 06:27:00.000 |
1505.0 |
177.5 |
|
(5 row(s) affected). |
In the WideHistory table, the column type is determined by the tag type.
SELECT * FROM OpenQuery(INSQL, 'SELECT DateTime, SysTimeMin, SysPulse, SysString FROM WideHistory
WHERE DateTime >= "2001-12-20 0:00"
AND DateTime <= "2001-12-20 0:05"
AND wwRetrievalMode = "delta"
')
The results are:
|
DateTime |
SysTimeMin |
SysPulse |
SysString |
|
2001-12-20 00:00:00.000 |
0 |
0 |
2001/12/20 08:00:00 |
|
2001-12-20 00:01:00.000 |
1 |
1 |
2001/12/20 08:00:00 |
|
2001-12-20 00:02:00.000 |
2 |
0 |
2001/12/20 08:00:00 |
|
2001-12-20 00:03:00.000 |
3 |
1 |
2001/12/20 08:00:00 |
|
2001-12-20 00:04:00.000 |
4 |
0 |
2001/12/20 08:00:00 |
|
2001-12-20 00:05:00.000 |
5 |
1 |
2001/12/20 08:00:00 |