# 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
<b>mes.spGetStateEvent @stateEventId</b><br /><br />

<b>Parameters:</b><br />
@stateEventId (int): The unique identifier of the state event to retrieve.<br /><br />

<b>Returns:</b><br />
A single row with the following key columns:<br />
- **stateEventId**: Identifier of the state event<br />
- **assetId / assetName / assetPath**: Associated asset information<br />
- **stateCode / origStateCode**: Current and original state codes<br />
- **assetStateId / origAssetId**: State-specific asset details<br />
- **stateName / stateTypeName / stateCategoryName**: Descriptive state metadata<br />
- **stateStart / stateEnd**: Start and end time of the event<br />
- **note / changedBy**: Change metadata<br />

### Code Example

```sql
EXEC mes.spGetStateEvent @stateEventId = 9042;
