TN Hist214 Querying for NULL's in the Historian
Description
This technote from InSource provides SQL queries to use in troubleshooting NULL values found in the Wonderare Historian.
- Author: Rich Brooks
- Published: 4/29/2015
- Applies to: Historian v11.6 and higher
Details
Null’s occasionally show up in the data retrieved from the Historian. Gaps in trend data result from null value stored during the sample period. This is often an indication of bad quality data resulting from a loss of communication. The following are two simple queries that may be used to check for Null’s from the Live or History tables in the Runtime database. These may be run from the Historian Client or SQL Server Management Studio Query tools.
Select DateTime, TagName, vValue, QualityDetail
From Live
Where Tagname not like 'sys%'
and vValue is Null
Select DateTime, TagName, vValue, QualityDetail
From History
Where Tagname not like 'sys%'
and vValue is Null
The results of these queries may be used as a troubleshooting tool to narrow down the issue to specific tags or topics. You may notice that the quality detail differs from the Live and History results. Live is showing good quality (192) and History is showing bad quality (0). Nulls are marked as bad quality when stored in the Historian.