Friday, 17 March 2017

Error Severity in SQL in sql server

When an error is raised by the SQL Server Database Engine, the severity of the error indicates the type of problem encountered by SQL Server. In the sql server there are sixteen different severity levels in SQL Server 2012 and each severity represents criticalness of an error.

See the below example

I want to update my table. When I am trying to update my table, I am getting below error.
  
Error Message No: 245
Error severity level: 16
Error message: Conversion failed when converting the varchar value 'Bagesh' to data type int.

Error severity level: 16 means SQL Error Severity 16 indicates general errors that can be corrected by the user.
We can see the all error message with help of below sql script
select * from sys.messages
 

Here we get the error details
select * from sys.messages where severity=16
and message_id =245 and language_id=1033



Below is the list of sql severity

SQL Severity 0 to 9

“SQL Errors” with Severity between 0 and 9 are in fact informational messages that return status information or report errors that are not severe. SQL Server does not raise errors with severity between 0 and 9.

SQL Severity 10

Informational messages that return status information or report errors that are not severe.

SQL Severity 11

SQL Error Severity 11 indicates that the given object or entity does not exist.

SQL Severity 12

SQL Error Severity 12 it is a special severity for queries that do not use locking because of special query hints.

SQL Severity 13

SQL Error Severity 13 indicates transaction deadlock errors

SQL Severity 14

SQL Error Severity 14 indicates security-related errors, such as permission denied.

SQL Severity 15

SQL Error Severity 15 indicates syntax errors in the Transact-SQL command.

SQL Severity 16

SQL Error Severity 16 indicates general errors that can be corrected by the user.

SQL Severity 17

SQL Error Severity 17 indicates that the statement caused SQL Server to run out of resources

SQL Severity 18

SQL Error Severity 18 indicates a problem in the SQL Server Database Engine, but the statement completes execution, and the connection to the instance of the SQL Server is maintained.

SQL Severity 19

SQL Severity 19 indicates that a non-configurable SQL Server Database Engine limit has been exceeded and the current batch process has been terminated.

SQL Severity 20

SQL Severity 20 indicates that a statement has encountered a problem. The problem has affected only the current task.

SQL Severity 21

SQL Severity 21 indicates that a problem has been encountered that affects all tasks in the current database.

SQL Severity 22 

SQL Severity 22 indicates that the table or index specified in the message has been damaged.

SQL Severity 23

SQL Severity 23 indicates that the integrity of the entire database is a problem.

SQL Severity 24


SQL Severity 24 indicates a media failure.

No comments:

Post a Comment

If you have any doubt, please let me know.

Popular Posts