ERROR_STATE
reads error state
What changes
- Input
- the error that activated the current CATCH block
- Output or change
- error attribute (NULL outside CATCH)
- Return type
- int
Syntax at a glance
ERROR_STATE ( )
Work example
Read the state code of a caught error for diagnostic correlation.
Read state in the intended scope and immediately after the statement it describes. Treat host values as untrusted.
Check your work Pair with error number and procedure because state alone is not a unique identity.
Open Microsoft Learn for full syntax, permissions, and details for your version.