mes.fnGetStateSeconds
Description
Returns total duration in seconds for a given state type within a time range for an asset.Syntax
mes.fnGetStateSeconds(@assetId, @rangeStart, @rangeEnd, @stateTypeId)Parameters:
Returns:
Code Example
SELECT mes.fnGetStateSeconds(
2076,
'2025-07-30T00:00:00',
'2025-07-30T12:00:00',
2
) AS seconds_in_state;