Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server all Errors List?

I am trying to capture a list of all SQL Server errors so my calling C# (.NET 4.0) can do different things based on what occurs.

I am trying to get all of the things in http://technet.microsoft.com/en-us/library/cc645611.aspx and all of the other related pages.

Obviously SQL Server has these in a table somewhere already, but where?

Thanks.

like image 606
Snowy Avatar asked Sep 22 '11 14:09

Snowy


People also ask

What are the errors in SQL?

There are two types of errors in SQL Server: system errors and custom errors. System errors can be viewed in the sys. messages system view and are defined by SQL server. Therefore, when a system error occurs, SQL Server will log a system error and may take actions to fix the error.

Where would you look for errors from the database engine?

All system and user-defined error messages in an instance of the Database Engine are contained in the sys. messages catalog view. You can use the RAISERROR statement to return user-defined errors to an application.


1 Answers

SELECT message_id, severity, text
  FROM sys.messages 
  WHERE language_id = 1033; -- assuming US English
like image 150
Aaron Bertrand Avatar answered Dec 14 '22 23:12

Aaron Bertrand