SQL Server/T-SQL/System/sysmessages
Версия от 13:46, 26 мая 2010; (обсуждение)
Retrieve additional error information: sysmessages table
1> -- Retrieve additional error information: sysmessages table
2>
3>
4> SELECT 5 / 0
5> SELECT * FROM master.dbo.sysmessages WHERE error = @@ERROR
6> GO
Msg 8134, Level 16, State 1, Server sqle\SQLEXPRESS, Line 4
Divide by zero error encountered.
error severity dlevel description
msglangid
----------- -------- ------ ----------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------- ---------
8134 16 0 Divide by zero error encountered.
1033
(1 rows affected)
1>
SELECT TOP 10 * FROM master.dbo.sysmessages
1> -- @@ERROR: contains the last error number for the current connection.
2> -- The default value for @@ERROR is zero.
3>
4> SELECT TOP 10 * FROM master.dbo.sysmessages
5>
6> GO
error severity dlevel description
msglangid
----------- -------- ------ --------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------- ---------
21 20 0 Warning: Fatal error %d occurred at %S_DATE. Note the error and time, and contact your system administrator.
1033
101 15 0 Query not allowed in WAITFOR.
1033
102 15 0 Incorrect syntax near "%.*ls".
1033
103 15 0 The %S_MSG that starts with "%.*ls" is too long. Maximum length is %d.
1033
104 15 0 ORDER BY items must appear in the select list if the statement contains a UNION, INTERSECT or EXCEPT operator.
1033
105 15 0 Unclosed quotation mark after the character string "%.*ls".
1033
106 16 0 Too many table names in the query. The maximum allowable is %d.
1033
107 15 0 The column prefix "%.*ls" does not match with a table name or alias name used in the query.
1033
108 15 0 The ORDER BY position number %ld is out of range of the number of items in the select list.
1033
109 15 0 There are more columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the numb
er of columns specified in the INSERT statement. 1033
(10 rows affected)
1>