What does Level and State refer to in Microsoft SQL Server Query Analyzer

886 views Asked by At

I use Query Analyzer all the time and am often greeted by errors where I am told a level and a state but never a line number. Presumably level and state are useful pieces of information, though I have never seen these defined.

1

There are 1 answers

0
JBJ On

State: microsoft

State Some error messages can be raised at multiple points in the code for the Database Engine. For example, an 1105 error can be raised for several different conditions. Each specific condition that raises an error assigns a unique state code.

When you are viewing databases that contain information about known issues, such as the Microsoft Knowledge Base, you can use the state number to determine whether the recorded issue is the same as the error you have encountered. For example, if a Knowledge Base Article describes an 1105 error that has a state of 2 and the 1105 error message you received had a state of 3, the error probably has a different cause than the one reported in the article.

A Microsoft support engineer can also use the state code from an error to find the location in the source code where that error code is being raised. This information might provide additional ideas on how to diagnose the problem.

Level (of severity): Microsoft again

Also see: RaisError()

In real life practice (+15 years), if I don't understand the error I just paste it in a search. and look for similar errors that give a better explanation of the problem or a place to start looking for a solution.