Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Historian

Using StartDateTime in the query criteria

  • Last UpdatedMar 19, 2025
  • 1 minute read

You cannot use StartDateTime in the query criteria instead of DateTime. For example, the following query works, except that it does not apply the StartDateTime >= @StartDate clause.

SET NOCOUNT ON

DECLARE @StartDate DateTime

DECLARE @EndDate DateTime

SET @StartDate = DateAdd(mi,-30,GetDate())

SET @EndDate = GetDate()

SET NOCOUNT OFF

SELECT History.TagName, DateTime = convert(nvarchar, DateTime, 21), Value, vValue, StateTime, StartDateTime

FROM History

WHERE History.TagName IN ('Reactor1Level')

AND wwRetrievalMode = 'RoundTrip'

AND wwStateCalc = 'AvgContained'

AND vValue = convert(SQL_VARIANT, '1')

AND wwCycleCount = 1

AND wwTimeStampRule = 'Start'

AND wwQualityRule = 'Good'

AND wwFilter = 'ToDiscrete(5.0,>)'

AND wwVersion = 'Latest'

AND DateTime >= @StartDate

AND DateTime <= @EndDate

AND StartDateTime >= @StartDate

TitleResults for “How to create a CRG?”Also Available in