5.8. ERROR HANDLING

Robust programming in any language requires the program to be able to take reasonable action when things don't go as intended. Table 5-4 lists typical error messages.

Table 5-4. Typical Error Messages
Managing Error Messages

Error Log Files— record of SQL Server error occurrences and

sysmessages Table— table of SQL Server error definitions

sp_addmessage, sp_altermessage, sp_dropmessageUsers may add their own error messages.
@@ERRORThe error status of most recently executed statement returns.
RAISERRORUser may invoke a system- or user-defined error condition.

5.8.1. Managing Error Messages

5.8.1.1. Error Log Files—SQL Server Error Logs, Windows NT Application Log

The occurrence of an error by SQL Server is recorded in SQL Server ...

Get Transact-SQL Desk Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.