How Adaptive Server uses error messages to respond to system problems

When Adaptive Server encounters a problem, it displays information—in an error message that describes whether the problem is caused by the user or the system—about the problem, how serious it is, and what you can do to fix it. The error message consists of:

For example, this is what happens if you try to access a table that does not exist:

select * from publisher
Msg 208, Level 16, State 1: 
publisher not found. Specify owner.objectname or use sp_help to check whether the object exists (sp_help may produce lots of output).

In some cases, there can be more than one error message for a single query. If there is more than one error in a batch or query, Adaptive Server usually reports only the first one. Subsequent errors are reported the next time you execute the batch or query.

The error messages are stored in master..sysmessages, which is updated with each new release of Adaptive Server. Here are the first few rows (from an Adaptive Server with us_english as the default language):

select error, severity, description 
from sysmessages 
where error >=101 and error <=106
and langid is null
error severity description
----- -------- --------------------------------------------------
  101       15 Line %d: SQL syntax error.
  102       15 Incorrect syntax near '%.*s'.
  103       15 The %S_MSG that starts with ’%.*s’ is too long.
               Maximum length is %d.
  104       15 Order-by items must appear in the select-list if
               the statement contains set operators.
  105       15 Unclosed quote before the character string '%.*s'.
  106       16 Too many table names in the query. The maximum
               allowable is %d.

(6 rows affected)

You can generate your own list by querying sysmessages. Here is some additional information for writing your query: