mes.spGetStateEvent
Description
This stored procedure returns detailed diagnostic information for a given `stateEventId`. It identifies the start and end timestamps, associated asset, state codes, and descriptive metadata from multiple joined views and tables. Useful for event auditing and state history analysis.Syntax
mes.spGetStateEvent @stateEventIdParameters:
@stateEventId (int): The unique identifier of the state event to retrieve.
Returns:
A single row with the following key columns:
- **stateEventId**: Identifier of the state event
- **assetId / assetName / assetPath**: Associated asset information
- **stateCode / origStateCode**: Current and original state codes
- **assetStateId / origAssetId**: State-specific asset details
- **stateName / stateTypeName / stateCategoryName**: Descriptive state metadata
- **stateStart / stateEnd**: Start and end time of the event
- **note / changedBy**: Change metadata
Code Example
EXEC mes.spGetStateEvent @stateEventId = 9042;