Содержание
- Understanding Database Engine Errors
- Основные сведения об ошибках компонента Database Engine
- ERROR_NUMBER (Transact-SQL)
- Синтаксис
- Типы возвращаемых данных
- Возвращаемое значение
- Remarks
- Примеры
- A. Использование функции ERROR_NUMBER в блоке CATCH
- Б. Использование функции ERROR_NUMBER в блоке CATCH с другими средствами обработки ошибок
- ERROR_NUMBER (Transact-SQL)
- Syntax
- Return Types
- Return Value
- Remarks
- Examples
- A. Using ERROR_NUMBER in a CATCH block
- B. Using ERROR_NUMBER in a CATCH block with other error-handling tools
- RAISERROR (Transact-SQL)
- Синтаксис
- Аргументы
- msg_id
- msg_str
- @local_variable
- severity
- state
- argument
- Параметр
- Remarks
- Разрешения
- Примеры
- A. Возвращение сведений об ошибке из блока CATCH
- Б. Создание нерегламентированного сообщения в представлении каталога sys.messages
- В. Использование локальной переменной для предоставления текста сообщения
Understanding Database Engine Errors
Applies to: SQL Server (all supported versions) Azure SQL Database Azure SQL Managed Instance Azure Synapse Analytics Analytics Platform System (PDW)
Errors raised by the Microsoft SQL Server Database Engine have the attributes described in the following table.
Attribute | Description |
---|---|
Error number | Each error message has a unique error number. |
Error message string | The error message contains diagnostic information about the cause of the error. Many error messages have substitution variables in which information, such as the name of the object generating the error, is inserted. |
Severity | The severity indicates how serious the error is. Errors that have a low severity, such as 1 or 2, are information messages or low-level warnings. Errors that have a high severity indicate problems that should be addressed as soon as possible. For more information about severities, see Database Engine Error Severities. |
State | Some error messages can be raised at multiple points in the code for the Database Engine. For example, an 1105 error can be raised for several different conditions. Each specific condition that raises an error assigns a unique state code.
When you are viewing databases that contain information about known issues, such as the Microsoft Knowledge Base, you can use the state number to determine whether the recorded issue is the same as the error you have encountered. For example, if a Knowledge Base Article describes an 1105 error that has a state of 2 and the 1105 error message you received had a state of 3, the error probably has a different cause than the one reported in the article. A Microsoft support engineer can also use the state code from an error to find the location in the source code where that error code is being raised. This information might provide additional ideas on how to diagnose the problem. |
Procedure name | Is the name of the stored procedure or trigger in which the error has occurred. |
Line number | Indicates which statement in a batch, stored procedure, trigger, or function generated the error. |
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.
All database APIs, such as the Microsoft .NET Framework SQLClient namespace, ActiveX Data Objects (ADO), OLE DB, and Open Database Connectivity (ODBC), report the basic error attributes. This information includes the error number and message string. However, not all the APIs report all the other error attributes.
Information about an error that occurs in the scope of the TRY block of a TRY. CATCH construct can be obtained in Transact-SQL code by using functions such as ERROR_LINE, ERROR_MESSAGE, ERROR_NUMBER, ERROR_PROCEDURE, ERROR_SEVERITY, and ERROR_STATE in the scope of the associated CATCH block. For more information, see TRY. CATCH (Transact-SQL).
Источник
Основные сведения об ошибках компонента Database Engine
Применимо к: SQL Server (все поддерживаемые версии) Azure SQL database Управляемый экземпляр SQL Azure Azure Synapse Analytics Analytics Platform System (PDW)
Ошибки, возникшие в компоненте Microsoft Компонент SQL Server Database Engine, имеют атрибуты, описанные в следующей таблице.
attribute | Описание |
---|---|
Номер ошибки | Каждое сообщение имеет уникальный номер ошибки. |
Строка сообщения об ошибке | Сообщение об ошибке содержит диагностические сведения о причине ошибки. Многие сообщения об ошибках имеют подстановочные переменные, в которые заносятся сведения, например имя объекта, вызвавшего ошибку. |
Severity | Степень серьезности ошибки указывает, насколько она значительна. Ошибки с низкой степенью серьезности, например 1 или 2, являются информационными сообщениями или предупреждениями низкого уровня. Ошибки с высокой степенью серьезности указывают на проблемы, которые должны быть решены как можно быстрее. Дополнительные сведения о степенях серьезности см. в разделе Степени серьезности ошибок компонента Database Engine. |
Состояние | Некоторые сообщения об ошибках могут возникнуть в нескольких точках кода компонента Компонент Database Engine. Например, ошибка 1105 может возникнуть при различных условиях. Каждое условие, которое вызывает ошибку, присваивает уникальный код состояния.
При просмотре баз данных со сведениями об известных неполадках, таких как база знаний Microsoft , можно использовать номер состояния, чтобы определить, является ли записанная неполадка возникшей ошибкой. Например, если статья базы знаний описывает ошибку 1105 с состоянием 2, а получена ошибка 1105 с состоянием 3, ошибка, вероятно, возникла не по той причине, которая описана в статье. Инженер поддержки Microsoft также может использовать код состояния, содержащийся в сообщении об ошибке, чтобы найти место в исходном коде, где эта ошибка возникла. Эти данные могут предоставить дополнительные сведения для диагностики проблемы. |
Имя процедуры | Имя хранимой процедуры или триггера, в которых произошла ошибка. |
Номер строки | Указывает на инструкцию в пакете, хранимой процедуре, триггере или функции, которая сформировала ошибку. |
Все системные и пользовательские сообщения об ошибках в экземпляре компонента Компонент Database Engine содержатся в представлении каталога sys.messages . Инструкцию RAISERROR можно использовать для возвращения пользовательских ошибок приложению.
Все API-интерфейсы базы данных, например пространство имен Microsoft .NET Framework SQLClient, ActiveX Data Objects (ADO), OLE DB и Open Database Connectivity (ODBC), сообщают основные атрибуты ошибки. Эти сведения включают номер ошибки и строку сообщения. Однако не все API-интерфейсы сообщают остальные атрибуты ошибки.
Сведения об ошибке, возникающей в области блока TRY try try. Конструкцию CATCH можно получить в коде Transact-SQL с помощью таких функций, как ERROR_LINE, ERROR_MESSAGE, ERROR_NUMBER, ERROR_PROCEDURE, ERROR_SEVERITY и ERROR_STATE в области связанного блока CATCH. Дополнительные сведения см. в разделе TRY. CATCH (Transact-SQL).
Источник
ERROR_NUMBER (Transact-SQL)
Область применения: SQL Server (все поддерживаемые версии) База данных SQL Azure Управляемый экземпляр SQL Azure Azure Synapse Analytics Analytics Platform System (PDW)
Эта функция возвращает номер ошибки, которая вызвала выполнение блока CATCH конструкции TRY. CATCH.
Соглашения о синтаксисе Transact-SQL
Синтаксис
Ссылки на описание синтаксиса Transact-SQL для SQL Server 2014 и более ранних версий, см. в статье Документация по предыдущим версиям.
Типы возвращаемых данных
int
Возвращаемое значение
При вызове в блоке CATCH функция ERROR_NUMBER возвращает номер ошибки, вызвавшей выполнение блока CATCH.
Функция ERROR_NUMBER возвращает значение NULL в случае вызова вне блока CATCH.
Функцию ERROR_NUMBER можно вызывать в любом месте области действия блока CATCH.
Функция ERROR_NUMBER возвращает соответствующий номер ошибки независимо от количества ее выполнений или от места ее вызова в области действия блока CATCH . В этом ее отличие от таких функций, как @@ERROR, которые возвращают номер ошибки только в той инструкции, которая непосредственно следует за инструкцией, вызвавшей ошибку.
Во вложенном блоке CATCH функция ERROR_NUMBER возвращает номер ошибки, соответствующий области действия блока CATCH , который ссылался на данный блок CATCH . Например, блок CATCH внешней конструкции TRY. CATCH может содержать внутреннюю конструкцию TRY. CATCH . Во внутреннем блоке CATCH функция ERROR_NUMBER возвращает номер ошибки, вызвавшей внутренний блок CATCH . Если функция ERROR_NUMBER выполняется во внешнем блоке CATCH , она возвращает номер ошибки, вызвавшей внешний блок CATCH .
Примеры
A. Использование функции ERROR_NUMBER в блоке CATCH
В приведенном ниже примере показана инструкция SELECT , вызывающая ошибку деления на ноль. Блок CATCH возвращает номер ошибки.
Б. Использование функции ERROR_NUMBER в блоке CATCH с другими средствами обработки ошибок
В приведенном ниже примере показана инструкция SELECT , вызывающая ошибку деления на ноль. Вместе с номером ошибки блок CATCH возвращает сведения о ней.
Источник
ERROR_NUMBER (Transact-SQL)
Applies to: SQL Server (all supported versions) Azure SQL Database Azure SQL Managed Instance Azure Synapse Analytics Analytics Platform System (PDW)
This function returns the error number of the error that caused the CATCH block of a TRY. CATCH construct to execute.
Transact-SQL syntax conventions
Syntax
To view Transact-SQL syntax for SQL Server 2014 and earlier, see Previous versions documentation.
Return Types
int
Return Value
When called in a CATCH block, ERROR_NUMBER returns the error number of the error that caused the CATCH block to run.
ERROR_NUMBER returns NULL when called outside the scope of a CATCH block.
ERROR_NUMBER supports calls anywhere within the scope of a CATCH block.
ERROR_NUMBER returns a relevant error number regardless of how many times it runs, or where it runs within the scope of the CATCH block. This contrasts with a function like @@ERROR, which only returns an error number in the statement immediately following the one that causes an error.
In a nested CATCH block, ERROR_NUMBER returns the error number specific to the scope of the CATCH block that referenced that CATCH block. For example, the CATCH block of an outer TRY. CATCH construct could have an inner TRY. CATCH construct. Inside that inner CATCH block, ERROR_NUMBER returns the number of the error that invoked the inner CATCH block. If ERROR_NUMBER runs in the outer CATCH block, it returns the number of the error that invoked that outer CATCH block.
Examples
A. Using ERROR_NUMBER in a CATCH block
This example shows a SELECT statement that generates a divide-by-zero error. The CATCH block returns the error number.
Here is the result set.
B. Using ERROR_NUMBER in a CATCH block with other error-handling tools
This example shows a SELECT statement that generates a divide-by-zero error. Along with the error number, the CATCH block returns information about that error.
Источник
RAISERROR (Transact-SQL)
Область применения: SQL Server (все поддерживаемые версии) База данных SQL Azure Управляемый экземпляр SQL Azure Azure Synapse Analytics Analytics Platform System (PDW)
Инструкция RAISERROR не учитывает SET XACT_ABORT . Новые приложения должны использовать THROW вместо RAISERROR .
Создает сообщение об ошибке и запускает обработку ошибок для сеанса. RAISERROR может либо ссылаться на определяемое пользователем сообщение, хранящееся в sys.messages , либо динамически создавать сообщение. Это сообщение возвращается как сообщение об ошибке сервера вызывающему приложению или соответствующему блоку CATCH конструкции TRY. CATCH . В новых же приложениях следует использовать инструкцию THROW.
Соглашения о синтаксисе Transact-SQL
Синтаксис
Синтаксис для SQL Server и Базы данных SQL Azure:
Синтаксис для Azure Synapse Analytics и Parallel Data Warehouse:
Ссылки на описание синтаксиса Transact-SQL для SQL Server 2014 и более ранних версий, см. в статье Документация по предыдущим версиям.
Аргументы
msg_id
Определяемый пользователем номер сообщения об ошибке, который хранится в представлении каталога sys.messages с помощью sp_addmessage . Номера пользовательских сообщений об ошибках должны быть больше 50 000. Если аргумент msg_id не определен, то инструкция RAISERROR создает сообщение об ошибке с номером ошибки 50000.
msg_str
Определяемое пользователем сообщение с форматом, аналогичным формату функции printf из стандартной библиотеки языка С. Это сообщение об ошибке не должно содержать более 2 047 символов. Если сообщение содержит 2 048 и более символов, то отображаются только первые 2 044, а за ними появляется знак многоточия, показывающий, что сообщение было усечено. Обратите внимание, что параметры подстановки содержат больше символов, чем видно на выходе из-за внутренней структуры хранения. Например, если параметр подстановки %d имеет значение 2, он выводит один символ в строку сообщения, хотя при хранении занимает три дополнительных символа. Из-за этой особенности хранения количество доступных символов для выходного сообщения уменьшается.
Если аргумент msg_str определен, то инструкция RAISERROR создает сообщение об ошибке с номером ошибки 50000.
Аргумент msg_str является символьной строкой, которая может содержать спецификации преобразования. Каждая спецификация преобразования определяет, каким образом значение из списка аргументов будет отформатировано и помещено в поле в местоположении спецификации преобразования в строке msg_str. Спецификации преобразования имеют следующий формат:
В строке msg_str могут использоваться следующие параметры:
Код, определяющий промежутки и выравнивание подставляемого значения.
Код | Префикс или выравнивание | Описание |
---|---|---|
— (знак «минус») | Выравнивать слева | Выравнивает значение аргумента по левой границе поля заданной ширины. |
+ (знак «плюс») | Префикс знака | Добавляет перед значением аргумента знак «плюс» (+) или «минус» (-), если значение принадлежит к типу со знаком. |
0 (ноль) | Дополнение нулями | Добавляет к выходному значению спереди нули до тех пор, пока не будет достигнута минимальная ширина. При одновременном указании 0 и знака «минус» (-) флаг 0 не учитывается. |
# (число) | Префикс 0x для шестнадцатеричного типа x или X | При использовании формата o, x или X флаг знака числа (#) предшествует любому ненулевому значению 0, 0x или 0X соответственно. Если флаг знака числа (#) стоит перед d, i или u, он пропускается. |
‘ ‘ (blank) | Заполнение пробелами | Добавляет к выходным значениям пробелы, если значение со знаком и положительно. Этот параметр не учитывается, если включается вместе с флагом знака «плюс» (+). |
width
Целое число, определяющее минимальную ширину поля, в которое помещается значение аргумента. Если длина значения аргумента равна значению параметра width или превышает его, то значение записывается без заполнения. Если значение короче, чем значение параметра width, оно дополняется до длины, определенной в параметре width.
Символ «звездочка» (*) означает, что ширина определяется соответствующим аргументом в списке аргументов, значение которого должно быть целым числом.
precision
Максимальное число символов, берущееся из значения аргумента для значения строки. Например, если в строке содержится пять символов, а точность равна 3, то для значения строки используются первые три символа.
Для целых значений аргумент precision определяет минимальное количество отображаемых цифр.
Символ «звездочка» (*) означает, что точность определяется соответствующим аргументом в списке аргументов, значение которого должно быть целым числом.
Используется с типами символов d, i, o, s, x, X или u, создает значения типа данных shortint (h) или longint (l).
Спецификация типа | Представляет |
---|---|
d или i | Целое число со знаком |
o | Восьмеричное число без знака |
s | Строка |
u | Целое число без знака |
x или X | Шестнадцатеричное число без знака |
Эти спецификации типа основаны на изначально определенных доя функции printf в стандартной библиотеке C. Спецификации типов, используемые в строках сообщений инструкции RAISERROR , сопоставляются с типами данных языка Transact-SQL, а спецификации, используемые в функции printf , сопоставляются с типами данных языка C. Спецификации типов, используемые в функции printf , не поддерживаются инструкцией RAISERROR , если в языке Transact-SQL нет типов данных, схожих с соответствующими типами данных языка C. Например, спецификация %p для указателей не поддерживается инструкцией RAISERROR , так как в языке Transact-SQL нет типа данных для указателей.
Для преобразования какого-либо значения в тип данных Transact-SQL bigint нужно указать спецификацию %I64d.
@local_variable
Переменная любого допустимого типа данных для символов, содержащая строку того же формата, что и строка msg_str. Аргумент @local_variable должен иметь тип char или varchar, либо поддерживать неявное преобразование в эти типы данных.
severity
Определенный пользователем уровень серьезности, связанный с этим сообщением. Если при помощи аргумента msg_id вызываются определяемые пользователем сообщения, созданные процедурой sp_addmessage , то уровень серьезности, указанный в RAISERROR , заменяет уровень серьезности, указанный в процедуре sp_addmessage .
Для степеней серьезности от 19 до 25 требуется параметр WITH LOG. Степени серьезности меньше 0 интерпретируются как 0. Степени серьезности больше 25 интерпретируются как 25.
Уровни серьезности от 20 до 25 считаются неустранимыми. Если обнаруживается неустранимый уровень серьезности, то после получения сообщения соединение с клиентом обрывается и регистрируется сообщение об ошибке в журналах приложений и ошибок.
Можно указать -1 , чтобы получить степень серьезности, связанную с ошибкой, как показано в следующем примере.
state
Целое число от 0 до 255. Для отрицательных значений по умолчанию используется 1. Значения больше 255 использовать не следует.
Если одна и та же пользовательская ошибка возникает в нескольких местах, то при помощи уникального номера состояния для каждого местоположения можно определить, в каком месте кода появилась ошибка.
argument
Параметры, использующиеся при подстановке для переменных, определенных в msg_str, или для сообщений, соответствующих аргументу msg_id. Число параметров подстановки может быть от 0 и более, при этом общее количество параметров подстановки не может превышать 20. Каждый параметр подстановки может быть локальной переменной или любым из этих типов данных: tinyint, smallint, int, char, varchar, nchar, nvarchar, binary или varbinary. Другие типы данных не поддерживаются.
Параметр
Настраиваемый параметр для ошибки может принимать одно из значений, находящихся в следующей таблице.
Значение | Описание |
---|---|
LOG | Записывает сообщения об ошибках в журнал ошибок и журнал приложения экземпляра компонента Microsoft SQL Server Компонент Database Engine. Сообщения об ошибках в журнале ошибок ограничены размером в 440 байт. Только члены предопределенной роли сервера sysadmin или пользователи с разрешениями ALTER TRACE могут указывать ключевое слово WITH LOG.
Применяется к: SQL Server |
NOWAIT | Немедленно посылает сообщения клиенту.
Применимо к: SQL Server, База данных SQL |
SETERROR | Устанавливает значения параметров @@ERROR и ERROR_NUMBER равными msg_id или 50000, независимо от уровня серьезности.
Применимо к: SQL Server, База данных SQL |
Ошибки, созданные инструкцией RAISERROR , аналогичны ошибкам, созданным кодом компонента «Ядро СУБД». Значения, указанные RAISERROR , передаются системными функциями ERROR_LINE , ERROR_MESSAGE , ERROR_NUMBER , ERROR_PROCEDURE , ERROR_SEVERITY , ERROR_STATE и @@ERROR . Если инструкция RAISERROR с уровнем серьезности 11 или выше выполняется в блоке TRY, управление передается соответствующему блоку CATCH . Ошибка возвращается вызывающему объекту, если инструкция RAISERROR вызывается:
за пределами области любого блока TRY ;
с уровнем серьезности, равным 10 и менее в блоке TRY ;
с уровнем серьезности, равным 20 и выше, что приводит к обрыву подключения к базе данных.
В блоках CATCH инструкция RAISERROR может использоваться для передачи сообщения об ошибке, вызывающего блок CATCH , во время получения исходных сведений об ошибке при помощи таких системных функций, как ERROR_NUMBER и ERROR_MESSAGE . По умолчанию для сообщений с серьезностью от 1 до 10 параметр @@ERROR устанавливается в значение 0.
Если при помощи аргумента msg_id задано определяемое пользователем сообщение, доступное в представлении каталога sys.messages, RAISERROR обрабатывает сообщение из текстового столбца при помощи тех же правил, которые применялись к тексту определяемого пользователем сообщения, заданного аргументом msg_str. Текст сообщения, определяемого пользователем, может содержать спецификации преобразования, а RAISERROR сопоставит значения аргументов данным спецификациям преобразования. Процедура sp_addmessage позволяет добавить пользовательские сообщения об ошибках, процедура sp_dropmessage — удалять их.
Инструкция RAISERROR может использоваться в качестве альтернативы инструкции PRINT для возвращения сообщений вызывающим приложениям. Инструкция RAISERROR поддерживает функцию подстановки символов, сходную с функцией printf стандартной библиотеки языка С, которая отличается от инструкции Transact-SQL PRINT . Инструкция PRINT не зависит от блоков TRY , в то время как инструкция RAISERROR , выполняемая с уровнем серьезности от 11 до 19 в блоке TRY, передает управление процессом соответствующему блоку CATCH . Задайте уровень серьезности, равный 10 или меньше, чтобы инструкция RAISERROR возвращала сообщения из блока TRY без вызова блока CATCH .
Обычно последовательные аргументы заменяют последовательные спецификации преобразования; первый аргумент заменяет первую спецификацию преобразования, второй аргумент заменяет вторую спецификацию преобразования и так далее. Например, в следующей инструкции RAISERROR первый аргумент N’number’ подставляется на место первой спецификации преобразования %s , а второй аргумент 5 — на место второй спецификации преобразования %d. .
Если в качестве ширины или точности спецификации преобразования задан символ «звездочка» ( * ), то используемое для ширины или для точности значение определяется как значение аргумента целого типа. В этом случае одна спецификация преобразования может использоваться до трех аргументов — для значений ширины, точности и подстановки.
Например, каждая из следующих инструкций RAISERROR возвращает одну и ту же строку. Одна определяет значения ширины и точности в списке аргументов, другая определяет их в спецификации преобразования.
Разрешения
Степень серьезности от 0 до 18 может указать любой пользователь. Уровни серьезности от 19 до 25 могут быть указаны только членами предопределенной роли сервера sysadmin и пользователями с разрешениями ALTER TRACE.
Примеры
A. Возвращение сведений об ошибке из блока CATCH
Следующий пример кода показывает, как можно использовать инструкцию RAISERROR внутри блока TRY , чтобы передать управление блоку CATCH . Также в этом примере показано, каким образом для возвращения сведений об ошибке используется инструкция RAISERROR , которая вызывает блок CATCH .
Инструкция RAISERROR может формировать только ошибки с состоянием от 1 до 127 включительно. Так как компонент «Ядро СУБД» может вызывать ошибки с состоянием 0, рекомендуется проверять состояние ошибки, возвращаемое функцией ERROR_STATE, перед передачей его по значению в виде параметра состояния для RAISERROR .
Б. Создание нерегламентированного сообщения в представлении каталога sys.messages
В следующем примере показано, как инициировать сообщение, хранящееся в представлении каталога sys.messages. Это сообщение было добавлено в представление каталога sys.messages при помощи системной хранимой процедуры sp_addmessage как сообщение с номером 50005 .
В. Использование локальной переменной для предоставления текста сообщения
В следующем примере кода показано, как использовать локальную переменную для предоставления текста сообщения для инструкции RAISERROR .
Источник
List of error messages between 1 and 999 in SQL Server 2017.
These error messages are all available by querying the sys.messages
catalog view on the master
database.
The table below lists the SQL numeric error codes and their error messages. These codes are returned as the SQLCODE variable value.
Note:
While this document lists error codes as negative values, JDBC and ODBC clients always receive positive values. For example, if an ODBC or JDBC application returns error code 30, look up error code -30 in this table.
SQLCODE 0 and 100
There are two SQLCODE values that do not represent an SQL error:
SQL Error Codes 0 and 100
Error Code | Description |
---|---|
0 | Successful Completion |
100 | No (more) data |
-
SQLCODE=0 indicates successful completion of an SQL operation. For a SELECT statement, this usually means the successful retrieval of data from a table. However, if the SELECT performs an aggregate operation, (for example: SELECT SUM(myfield)) the aggregate operation is successful and an SQLCODE=0 is issued even when there is no data in myfield; in this case SUM returns NULL and %ROWCOUNT=1.
-
SQLCODE=100 indicates that the SQL operation was successful, but found no data to act upon. This can occur for a number of reasons. For a SELECT these include: the specified table contains no data; the table contains no data that satisfies the query criteria; or row retrieval has reached the final row of the table. For an UPDATE or DELETE these include: the specified table contains no data; or the table contains no row of data that satisfies the WHERE clause criteria. In these cases %ROWCOUNT=0.
SQLCODE -400
The SQLCODE -400 error “Fatal error occurred” is a general error. It is generated when a more specific SQLCODE error code is not available.
Retrieving SQL Message Texts
To determine the meaning of an SQLCODE numeric code, use the following ObjectScript statement:
WRITE "SQLCODE=",$SYSTEM.SQL.SQLCODE(-nnn)
This SQLCODE()Opens in a new tab method can also be called as a stored procedure from ODBC or JDBC: %SYSTEM.SQL_SQLCODE(-nnn).
When possible (usually at SQL compile time), error messages include the name of the field, table, view, or other element that caused the error. Placeholders for these names are shown using the <name> syntax convention.
The %msg variable may contain an additional message error text for certain errors. For further details, refer to System Variables in the “Using Embedded SQL” chapter of Using Caché SQL.
The message texts returned are shown below in their English versions. The actual message text returned depends upon your locale setting.
For information on generating ObjectScript general errors from SQLCODE errors, refer to the %SYSTEM.ErrorOpens in a new tab class in the InterSystems Class Reference.
Table of SQL Error Codes and Messages
For ease of use, the SQL Error Codes Table has been divided into the following sub-tables:
-
Error Codes 0 and 100
-
Error Codes -1 to -99
-
Error Codes -101 to -399
-
Error Codes -400 to -500
-
WinSock Error Codes -10050 to -11002
SQL Error Codes -1 to -99
Error Code | Description |
---|---|
-1 | Invalid SQL statement |
-2 | Exponent digits missing after ‘E’ |
-3 | Closing quote («) missing |
-4 | A term expected, beginning with one of the following: identifier, constant, aggregate, %ALPHAUP, %EXACT, %MVR, %SQLSTRING, %SQLUPPER, %STRING, %UPPER, $$, :, +, -, (, NOT, EXISTS, or FOR |
-5 | Column number specified in ORDER does not match SELECT list |
-6 | ORDER BY column after UNION not found as SELECT column |
-7 | Exponent out of range |
-8 | Invalid DATEPART code for DATEPART(), DATENAME(), DATEADD(), or DATEDIFF() |
-9 | Incompatible SELECT lists used in UNION |
-10 | The SELECT list of the subquery must have exactly one item |
-11 | A scalar expression expected, not a condition |
-12 | A term expected, beginning with one of the following: identifier, constant, aggregate, $$, :, (, +, -, %ALPHAUP, %EXACT, %MVR, %SQLSTRING, %SQLUPPER, %STRING, or %UPPER |
-13 | An expression other than a subquery expected here |
-14 | A comparison operator is required here |
-15 | A condition expected after NOT |
-16 | Quantifier SOME expected after the FOR in the for-expression |
-17 | A for-condition expected after the ( in the for-expression |
-18 | IS (or IS NOT) NULL predicate can be applied only to a field |
-19 | An aggregate function cannot be used in a WHERE or GROUP BY clause |
-20 | Name conflict in the FROM list over label |
-21 | Pointer->Field reference may not be modified by an INSERT or UPDATE statement |
-22 | ORDER must specify column names, not numbers, when after ‘SELECT *’ |
-23 | Label is not listed among the applicable tables |
-24 | Ambiguous sort column |
-25 | Input encountered after end of query |
-26 | Missing FROM clause |
-27 | Field is ambiguous among the applicable tables |
-28 | Host variable name must begin with either % or a letter |
-29 | Field not found in the applicable tables |
-30 | Table or view not found |
-31 | Field not (found/unique) in table(s) |
-32 | Outer-join symbol ( =* or *= ) must be between two fields |
-33 | No field(s) found for table |
-34 | Optimizer failed to find a usable join order |
-35 | INSERT/UPDATE/DELETE not allowed for non-updateable view |
-36 | WITH CHECK OPTION (CHECKOPTION class parameter) not allowed for non-updateable views |
-37 | SQL Scalar/Aggregate/Unary function not supported for Stream fields |
-38 | No master map for table |
-39 | No RowID field for table |
-40 | ODBC escape extension not supported |
-41 | An extrinsic function call must have the form ‘$$tag^routine(…)’ |
-42 | Closing quotes («») missing following pattern match |
-43 | Table is ambiguous within #IMPORT schema name list |
-44 | Duplicate method or query characteristic |
-45 | Duplicate method in ObjectScript query body |
-46 | Required method missing in ObjectScript query body |
-47 | Invalid method or query characteristic |
-48 | Invalid trigger REFERENCING clause for the trigger’s event |
-49 | Trigger REFERENCING clause cannot be specified when trigger language not SQL |
-50 | Trigger specifies UPDATE OF <fieldlist> clause when trigger language not SQL |
-51 | SQL statement expected |
-52 | Cursor (Already/Was Not) DECLAREd |
-53 | Constant or variable expected as new value |
-54 | Array designator (last subscript omitted) expected after VALUES |
-55 | Invalid GRANT <role> TO or REVOKE <role> FROM |
-56 | GRANT/REVOKE Action not applicable to an object of this type |
-57 | Trigger specifies WHEN clause when trigger language not SQL |
-58 | Duplicate field found in trigger UPDATE OF <fieldlist> clause |
-59 | Cannot have more than one field |
-60 | An action (%ALTER, SELECT, UPDATE, etc.) expected |
-61 | Cursor not updateable |
-62 | Additional new values expected for INSERT/UPDATE |
-63 | Data exception — invalid escape character |
-64 | Incompatible SELECT list is used in INSERT |
-65 | Positive integer constant or variable expected |
-66 | Redundant fields found in SELECT list |
-67 | Implicit join (arrow syntax) not supported in ON clause |
-68 | Legacy outer join (=*, *=) not supported in ON clause |
-69 | SET <field> = <value expression> not allowed with WHERE CURRENT OF <cursor> |
-70 | Multi-Line field only valid for LIKE, Contains ([), or NULL Comparison. |
-71 | Multi-Line field must be the left operand of the Comparison. |
-72 | Multi-Line field not valid in ORDER BY clause |
-73 | Aggregates not supported in ORDER BY clause |
-74 | Duplicate <select-list> alias names found |
-75 | <trim_spec> and/or <trim_char> required before FROM in TRIM function. |
-76 | Cardinality mismatch between the SELECT-list and INTO-list. |
-77 | Qualified column reference not allowed in this JOIN context. |
-78 | Invalid transaction state. |
-79 | Referencing key and referenced key must be the same size |
-80 | Integer expected |
-81 | Column Constraint expected |
-82 | Multiple table %DESCRIPTION definitions found |
-83 | Multiple table %FILE definitions found |
-84 | Multiple table %NUMROWS definitions found |
-85 | Multiple table %ROUTINE definitions found |
-86 | Invalid field definition, no datatype defined |
-87 | Invalid table name |
-88 | Invalid field name |
-89 | Invalid index name |
-90 | Invalid view name |
-91 | Transaction mode cannot be specified more than once |
-92 | Level of isolation cannot be READ UNCOMMITTED or READ VERIFIED if READ WRITE specified |
-93 | number of conditions for the DIAGNOSTICS SIZE must be exact numeric |
-94 | Unsupported usage of OUTER JOIN |
-95 | Operation disallowed by operation table |
-96 | Specified level of isolation is not supported |
-97 | Duplicate select-list names found. |
-98 | License violation |
-99 | Privilege violation |
SQL Error Codes -101 to -399
Error Code | Description |
---|---|
-101 | Attempt to open a cursor that is already open |
-102 | Operation (FETCH/CLOSE/UPDATE/DELETE/…) attempted on an unopened cursor |
-103 | Positioned UPDATE or DELETE attempted, but the cursor is not positioned on any row |
-104 | Field validation failed in INSERT, or value failed to convert in DisplayToLogical or OdbcToLogical |
-105 | Field validation failed in UPDATE |
-106 | Row to DELETE not found |
-107 | Cannot UPDATE RowID or RowID based on fields |
-108 | Required field missing; INSERT or UPDATE not allowed |
-109 | Cannot find the row designated for UPDATE |
-110 | Locking conflict in filing |
-111 | Cannot INSERT into a ‘Default Only’ RowID or RowID based on field |
-112 | Access violation |
-113 | %THRESHOLD violation |
-114 | One or more matching rows is locked by another user |
-115 | Cannot INSERT/UPDATE/DELETE on a read only table |
-116 | Cardinality mismatch on INSERT/UPDATE between values list and number of table columns. |
-117 | Aggregates not supported in views |
-118 | Unknown or non-unique User or Role |
-119 | UNIQUE or PRIMARY KEY constraint failed uniqueness check upon INSERT |
-120 | UNIQUE or PRIMARY KEY constraint failed uniqueness check upon UPDATE |
-121 | FOREIGN KEY constraint failed referential check upon INSERT of row in referencing table |
-122 | FOREIGN KEY constraint failed referential check upon UPDATE of row in referencing table |
-123 | FOREIGN KEY constraint failed referential check upon UPDATE of row in referenced table |
-124 | FOREIGN KEY constraint failed referential check upon DELETE of row in referenced table |
-125 | UNIQUE or PRIMARY KEY Constraint failed uniqueness check upon creation of the constraint |
-126 | REVOKE with RESTRICT failed. |
-127 | FOREIGN KEY Constraint failed referential check upon creation of the constraint |
-128 | Argument to scalar function %OBJECT() must be a stream field |
-129 | Illegal value for SET OPTION locale property |
-130 | Before Insert trigger failed |
-131 | After Insert trigger failed |
-132 | Before Update trigger failed |
-133 | After Update trigger failed |
-134 | Before Delete trigger failed |
-135 | After Delete trigger failed |
-136 | View’s WITH CHECK OPTION validation failed in INSERT |
-137 | View’s WITH CHECK OPTION validation failed in UPDATE |
-138 | Cannot INSERT/UPDATE a value for a read only field |
-139 | Concurrency failure on update: row versions not the same |
-140 | Invalid length parameter passed to the SUBSTRING function |
-141 | Invalid input value passed to the CONVERT function |
-142 | Cardinality mismatch between the view-column-list and view query’s SELECT clause |
-143 | ORDER BY not valid in a view’s query |
-144 | A subquery is not allowed in an insert statement’s set/values clause |
-145 | SQLPREVENTFULLSCAN class parameter is 1 for this table. Query that performs full scan of data map is not allowed |
-146 | Unable to convert date input to a valid logical date value |
-147 | Unable to convert time input to a valid logical time value |
-148 | CREATE VIEW, ALTER VIEW, or a view’s query may not contain host variable references |
-149 | SQL Function encountered an error |
-150 | Optimistic concurrency locking for a class definition failed |
-151 | Index is not found within tables used by this statement |
-152 | Index is ambiguous within tables used by this statement |
-161 | References to an SQL connection must constitute a whole subquery |
-162 | SQL Connection is not defined |
-201 | Table or view name not unique |
-220 | Gateway query error |
-221 | Gateway query GetConnection() failed |
-222 | Gateway query AllocStatement() failed |
-223 | Gateway query Prepare() failed |
-225 | Gateway query BindParameters() failed |
-226 | Gateway query Execute() failed |
-227 | Gateway query Fetch() failed |
-228 | Gateway query GetData() failed |
-241 | Parallel query queue error |
-242 | Parallel query run-time error |
-300 | DDL not allowed on this table definition |
-301 | No Savepoint name |
-302 | Savepoint names starting with «SYS» are reserved |
-303 | No implicit conversion of Stream value to non-Stream field in UPDATE assignment is supported |
-304 | Attempt to add a NOT NULL field with no default value to a table which contains data |
-305 | Attempt to make field required when the table has one or more rows where the column value is NULL |
-306 | Column with this name already exists |
-307 | Primary key already defined for this table |
-308 | Identity column already defined for this table |
-309 | The left operand of %CONTAINS is not a property that supports the %Text interface |
-310 | Foreign key references non-existent table |
-311 | Foreign key with same name already defined for this table |
-312 | Invalid schema name. Must use delimited identifiers to reference this schema name |
-313 | Condition expression not supported for Stream fields |
-314 | Foreign key references non-unique key/column collection |
-315 | Constraint or Key not found |
-316 | Foreign key references non-existent key/column collection |
-317 | Cannot DROP Constraint — One or more Foreign Key constraints reference this Unique constraint |
-319 | Referenced table has no primary key defined |
-320 | Cannot DROP table — One or more Foreign Key constraints reference this table |
-321 | Cannot DROP view — One or more views reference this view |
-322 | Cannot DROP column — column is defined on one or more indexes or constraints |
-324 | Index with this name already defined for this table |
-325 | Index cannot be dropped because it is the IDKEY index and the table has data |
-333 | No such index defined |
-334 | Index name is ambiguous. Index found in multiple tables. |
-340 | No such database (namespace) defined |
-341 | Database file already exists |
-342 | Cannot delete system namespace |
-343 | Invalid database name |
-344 | Cannot drop database that you are currently using or connected to |
-350 | An unexpected error occurred executing SqlComputeCode |
-356 | SQL Function (function stored procedure) is not defined to return a value |
-357 | SQL Function (function stored procedure) is not defined as a function procedure |
-358 | SQL Function (function stored procedure) name not unique |
-359 | SQL Function (function stored procedure) not found |
-360 | Class not found |
-361 | Method or Query name not unique |
-362 | Method or Query not found |
-363 | Trigger not found |
-364 | Trigger with same EVENT, TIME, and ORDER already defined |
-365 | Trigger name not unique |
-366 | Schema name mismatch between trigger name and table name |
-370 | SQL CALL, more arguments specified than defined in the stored procedure |
-371 | :HVar = CALL … Specified for a procedure which does not return a value |
-372 | Support for extrinsic function calls are disabled |
-373 | An extrinsic function call may not call a % routine |
-374 | Cannot alter the datatype of a field to/from a stream type when the table contains data |
-375 | Cannot ROLLBACK to unestablished savepoint |
-376 | Unsupported CAST target specified |
-377 | Field appears more than once in assignment list of insert or update statement |
-378 | Datatype mismatch, explicit CAST is required |
-380 | Invalid or Missing argument to scalar function |
-381 | Too many arguments to scalar function |
SQL Error Codes -400 to -500
Error Code | Description |
---|---|
-400 | Fatal error occurred |
-401 | Fatal Connection error |
-402 | Invalid Username/Password |
-405 | Unable to read from communication device |
-406 | Unable to Write to Server |
-407 | Unable to Write to Server Master |
-408 | Unable to start server |
-409 | Invalid server function |
-410 | Invalid Directory |
-411 | No stream object defined for field |
-412 | General stream error |
-413 | Incompatible client/server protocol |
-415 | Fatal error occurred within the SQL filer |
-416 | CacheInfo Error |
-417 | Security Error |
-422 | SELECT request processed via ODBC, JDBC, or Dynamic SQL cannot contain an INTO clause |
-425 | Error processing stored procedure request |
-426 | Error preparing stored procedure |
-427 | Invalid stored procedure name |
-428 | Stored procedure not found |
-429 | Invalid number of input/output parameters for stored procedure |
-430 | Cannot initialize procedure context |
-431 | Stored procedure parameter type mismatch |
-432 | Function returned multiple rows when only a single value is expected |
-450 | Request timed out due to user timeout |
-451 | Unable to receive server message |
-452 | Message sequencing error |
-453 | Error in user initialization code |
-454 | Error sending external interrupt request |
-459 | Kerberos authentication failure |
-460 | General error |
-461 | Communication link failure |
-462 | Memory allocation failure |
-463 | Invalid column number |
-464 | Function sequence error |
-465 | Invalid string or buffer length |
-466 | Invalid parameter number |
-467 | Column type out of range |
-468 | Fetch type out of range |
-469 | Driver not capable |
-470 | Option value changed |
-471 | Duplicate cursor name |
-472 | A collection-valued property was expected |
-478 | Query recompiled: Result Set mismatch |
-500 | Fetch row count limit reached |
WinSock Error Codes -10050 to -11002
Error Code | Description |
---|---|
-10050 | WinSock: Network is down |
-10051 | WinSock: Network is unreachable |
-10052 | WinSock: Net dropped connection or reset |
-10054 | WinSock: Connection reset by peer (due to timeout or reboot) |
-10055 | WinSock: No buffer space available |
-10056 | WinSock: Socket is already connected |
-10057 | WinSock: Socket is not connected |
-10058 | WinSock: Cannot send after socket shutdown |
-10060 | WinSock: Connection timed out |
-10061 | WinSock: Connection refused |
-10064 | WinSock: Host is down |
-10065 | WinSock: No route to host |
-10070 | WinSock: Stale NFS file handle |
-10091 | WinSock: Network subsystem is unavailable |
-10092 | WinSock: WINSOCK DLL version out of range |
-10093 | WinSock: Successful WSASTARTUP not yet performed |
-11001 | WinSock: Host not found |
-11002 | WinSock: Nonauthoritative host not found |
Microsoft SQL Server Ошибки
Useful links
- System Error Messages
- Database Engine Error Severities
- Integration Services Error and Message Reference
- View and Read SQL Server Setup Log Files
- Troubleshoot the SQL Server Utility
- Common Issues: Licensing Errors
- SQL Server 2016 Distributed Replay Errors
- The Instance ID MSSQLSERVER Is Already In Use
- SQL Server: Detach/Attach Gotchas!
SQL Server All Errors List
SELECT message_id, severity, text
FROM sys.messages
WHERE language_id = 1033; /* assuming US English */
Your language_id
you can find in
sys.syslanguages
system view, column msglangid
:
langid | dateformat | datefirst | upgrade | name | alias | months | shortmonths | days | lcid | msglangid |
---|---|---|---|---|---|---|---|---|---|---|
0 | mdy | 7 | 0 | us_english | English | January,February,March,April,May,June,July,August,September,October,November,December | Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec | Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday | 1033 | 1033 |
1 | dmy | 1 | 0 | Deutsch | German | Januar,Februar,März,April,Mai,Juni,Juli,August,September,Oktober,November,Dezember | Jan,Feb,Mär,Apr,Mai,Jun,Jul,Aug,Sep,Okt,Nov,Dez | Montag,Dienstag,Mittwoch,Donnerstag,Freitag,Samstag,Sonntag | 1031 | 1031 |
2 | dmy | 1 | 0 | Français | French | janvier,février,mars,avril,mai,juin,juillet,août,septembre,octobre,novembre,décembre | janv,févr,mars,avr,mai,juin,juil,août,sept,oct,nov,déc | lundi,mardi,mercredi,jeudi,vendredi,samedi,dimanche | 1036 | 1036 |
3 | ymd | 7 | 0 | 日本語 | Japanese | 01,02,03,04,05,06,07,08,09,10,11,12 | 01,02,03,04,05,06,07,08,09,10,11,12 | 月曜日,火曜日,水曜日,木曜日,金曜日,土曜日,日曜日 | 1041 | 1041 |
4 | dmy | 1 | 0 | Dansk | Danish | januar,februar,marts,april,maj,juni,juli,august,september,oktober,november,december | jan,feb,mar,apr,maj,jun,jul,aug,sep,okt,nov,dec | mandag,tirsdag,onsdag,torsdag,fredag,lørdag,søndag | 1030 | 1030 |
5 | dmy | 1 | 0 | Español | Spanish | Enero,Febrero,Marzo,Abril,Mayo,Junio,Julio,Agosto,Septiembre,Octubre,Noviembre,Diciembre | Ene,Feb,Mar,Abr,May,Jun,Jul,Ago,Sep,Oct,Nov,Dic | Lunes,Martes,Miércoles,Jueves,Viernes,Sábado,Domingo | 3082 | 3082 |
6 | dmy | 1 | 0 | Italiano | Italian | gennaio,febbraio,marzo,aprile,maggio,giugno,luglio,agosto,settembre,ottobre,novembre,dicembre | gen,feb,mar,apr,mag,giu,lug,ago,set,ott,nov,dic | lunedì,martedì,mercoledì,giovedì,venerdì,sabato,domenica | 1040 | 1040 |
7 | dmy | 1 | 0 | Nederlands | Dutch | januari,februari,maart,april,mei,juni,juli,augustus,september,oktober,november,december | jan,feb,mrt,apr,mei,jun,jul,aug,sep,okt,nov,dec | maandag,dinsdag,woensdag,donderdag,vrijdag,zaterdag,zondag | 1043 | 1043 |
8 | dmy | 1 | 0 | Norsk | Norwegian | januar,februar,mars,april,mai,juni,juli,august,september,oktober,november,desember | jan,feb,mar,apr,mai,jun,jul,aug,sep,okt,nov,des | mandag,tirsdag,onsdag,torsdag,fredag,lørdag,søndag | 2068 | 2068 |
9 | dmy | 7 | 0 | Português | Portuguese | janeiro,fevereiro,março,abril,maio,junho,julho,agosto,setembro,outubro,novembro,dezembro | jan,fev,mar,abr,mai,jun,jul,ago,set,out,nov,dez | segunda-feira,terça-feira,quarta-feira,quinta-feira,sexta-feira,sábado,domingo | 2070 | 2070 |
10 | dmy | 1 | 0 | Suomi | Finnish | tammikuuta,helmikuuta,maaliskuuta,huhtikuuta,toukokuuta,kesäkuuta,heinäkuuta,elokuuta,syyskuuta,lokakuuta,marraskuuta,joulukuuta | tammi,helmi,maalis,huhti,touko,kesä,heinä,elo,syys,loka,marras,joulu | maanantai,tiistai,keskiviikko,torstai,perjantai,lauantai,sunnuntai | 1035 | 1035 |
11 | ymd | 1 | 0 | Svenska | Swedish | januari,februari,mars,april,maj,juni,juli,augusti,september,oktober,november,december | jan,feb,mar,apr,maj,jun,jul,aug,sep,okt,nov,dec | måndag,tisdag,onsdag,torsdag,fredag,lördag,söndag | 1053 | 1053 |
12 | dmy | 1 | 0 | čeština | Czech | leden,únor,březen,duben,květen,červen,červenec,srpen,září,říjen,listopad,prosinec | I,II,III,IV,V,VI,VII,VIII,IX,X,XI,XII | pondělí,úterý,středa,čtvrtek,pátek,sobota,neděle | 1029 | 1029 |
13 | ymd | 1 | 0 | magyar | Hungarian | január,február,március,április,május,június,július,augusztus,szeptember,október,november,december | jan,febr,márc,ápr,máj,jún,júl,aug,szept,okt,nov,dec | hétfő,kedd,szerda,csütörtök,péntek,szombat,vasárnap | 1038 | 1038 |
14 | dmy | 1 | 0 | polski | Polish | styczeń,luty,marzec,kwiecień,maj,czerwiec,lipiec,sierpień,wrzesień,październik,listopad,grudzień | I,II,III,IV,V,VI,VII,VIII,IX,X,XI,XII | poniedziałek,wtorek,środa,czwartek,piątek,sobota,niedziela | 1045 | 1045 |
15 | dmy | 1 | 0 | română | Romanian | ianuarie,februarie,martie,aprilie,mai,iunie,iulie,august,septembrie,octombrie,noiembrie,decembrie | Ian,Feb,Mar,Apr,Mai,Iun,Iul,Aug,Sep,Oct,Nov,Dec | luni,marţi,miercuri,joi,vineri,sîmbătă,duminică | 1048 | 1048 |
16 | ymd | 1 | 0 | hrvatski | Croatian | siječanj,veljača,ožujak,travanj,svibanj,lipanj,srpanj,kolovoz,rujan,listopad,studeni,prosinac | sij,vel,ožu,tra,svi,lip,srp,kol,ruj,lis,stu,pro | ponedjeljak,utorak,srijeda,četvrtak,petak,subota,nedjelja | 1050 | 1050 |
17 | dmy | 1 | 0 | slovenčina | Slovak | január,február,marec,apríl,máj,jún,júl,august,september,október,november,december | I,II,III,IV,V,VI,VII,VIII,IX,X,XI,XII | pondelok,utorok,streda,štvrtok,piatok,sobota,nedeľa | 1051 | 1051 |
18 | dmy | 1 | 0 | slovenski | Slovenian | januar,februar,marec,april,maj,junij,julij,avgust,september,oktober,november,december | jan,feb,mar,apr,maj,jun,jul,avg,sept,okt,nov,dec | ponedeljek,torek,sreda,četrtek,petek,sobota,nedelja | 1060 | 1060 |
19 | dmy | 1 | 0 | ελληνικά | Greek | Ιανουαρίου,Φεβρουαρίου,Μαρτίου,Απριλίου,Μα_ου,Ιουνίου,Ιουλίου,Αυγούστου,Σεπτεμβρίου,Οκτωβρίου,Νοεμβρίου,Δεκεμβρίου | Ιαν,Φεβ,Μαρ,Απρ,Μαϊ,Ιουν,Ιουλ,Αυγ,Σεπ,Οκτ,Νοε,Δεκ | Δευτέρα,Τρίτη,Τετάρτη,Πέμπτη,Παρασκευή,Σάββατο,Κυριακή | 1032 | 1032 |
20 | dmy | 1 | 0 | български | Bulgarian | януари,февруари,март,април,май,юни,юли,август,септември,октомври,ноември,декември | януари,февруари,март,април,май,юни,юли,август,септември,октомври,ноември,декември | понеделник,вторник,сряда,четвъртък,петък,събота,неделя | 1026 | 1026 |
21 | dmy | 1 | 0 | русский | Russian | Январь,Февраль,Март,Апрель,Май,Июнь,Июль,Август,Сентябрь,Октябрь,Ноябрь,Декабрь | янв,фев,мар,апр,май,июн,июл,авг,сен,окт,ноя,дек | понедельник,вторник,среда,четверг,пятница,суббота,воскресенье | 1049 | 1049 |
22 | dmy | 1 | 0 | Türkçe | Turkish | Ocak,Şubat,Mart,Nisan,Mayıs,Haziran,Temmuz,Ağustos,Eylül,Ekim,Kasım,Aralık | Oca,Şub,Mar,Nis,May,Haz,Tem,Ağu,Eyl,Eki,Kas,Ara | Pazartesi,Salı,Çarşamba,Perşembe,Cuma,Cumartesi,Pazar | 1055 | 1055 |
23 | dmy | 1 | 0 | British | British English | January,February,March,April,May,June,July,August,September,October,November,December | Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec | Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday | 2057 | 1033 |
24 | dmy | 1 | 0 | eesti | Estonian | jaanuar,veebruar,märts,aprill,mai,juuni,juuli,august,september,oktoober,november,detsember | jaan,veebr,märts,apr,mai,juuni,juuli,aug,sept,okt,nov,dets | esmaspäev,teisipäev,kolmapäev,neljapäev,reede,laupäev,pühapäev | 1061 | 1061 |
25 | ymd | 1 | 0 | latviešu | Latvian | janvāris,februāris,marts,aprīlis,maijs,jūnijs,jūlijs,augusts,septembris,oktobris,novembris,decembris | jan,feb,mar,apr,mai,jūn,jūl,aug,sep,okt,nov,dec | pirmdiena,otrdiena,trešdiena,ceturtdiena,piektdiena,sestdiena,svētdiena | 1062 | 1062 |
26 | ymd | 1 | 0 | lietuvių | Lithuanian | sausis,vasaris,kovas,balandis,gegužė,birželis,liepa,rugpjūtis,rugsėjis,spalis,lapkritis,gruodis | sau,vas,kov,bal,geg,bir,lie,rgp,rgs,spl,lap,grd | pirmadienis,antradienis,trečiadienis,ketvirtadienis,penktadienis,šeštadienis,sekmadienis | 1063 | 1063 |
27 | dmy | 7 | 0 | Português (Brasil) | Brazilian | Janeiro,Fevereiro,Março,Abril,Maio,Junho,Julho,Agosto,Setembro,Outubro,Novembro,Dezembro | Jan,Fev,Mar,Abr,Mai,Jun,Jul,Ago,Set,Out,Nov,Dez | Segunda-Feira,Terça-Feira,Quarta-Feira,Quinta-Feira,Sexta-Feira,Sábado,Domingo | 1046 | 1046 |
28 | ymd | 7 | 0 | 繁體中文 | Traditional Chinese | 一月,二月,三月,四月,五月,六月,七月,八月,九月,十月,十一月,十二月 | 01,02,03,04,05,06,07,08,09,10,11,12 | 星期一,星期二,星期三,星期四,星期五,星期六,星期日 | 1028 | 1028 |
29 | ymd | 7 | 0 | 한국어 | Korean | 01,02,03,04,05,06,07,08,09,10,11,12 | 01,02,03,04,05,06,07,08,09,10,11,12 | 월요일,화요일,수요일,목요일,금요일,토요일,일요일 | 1042 | 1042 |
30 | ymd | 7 | 0 | 简体中文 | Simplified Chinese | 01,02,03,04,05,06,07,08,09,10,11,12 | 01,02,03,04,05,06,07,08,09,10,11,12 | 星期一,星期二,星期三,星期四,星期五,星期六,星期日 | 2052 | 2052 |
31 | dmy | 1 | 0 | Arabic | Arabic | Muharram,Safar,Rabie I,Rabie II,Jumada I,Jumada II,Rajab,Shaaban,Ramadan,Shawwal,Thou Alqadah,Thou Alhajja | Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec | Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday | 1025 | 1025 |
32 | dmy | 7 | 0 | ไทย | Thai | มกราคม,กุมภาพันธ์,มีนาคม,เมษายน,พฤษภาคม,มิถุนายน,กรกฎาคม,สิงหาคม,กันยายน,ตุลาคม,พฤศจิกายน,ธันวาคม | ม.ค.,ก.พ.,มี.ค.,เม.ย.,พ.ค.,มิ.ย.,ก.ค.,ส.ค.,ก.ย.,ต.ค.,พ.ย.,ธ.ค. | จันทร์,อังคาร,พุธ,พฤหัสบดี,ศุกร์,เสาร์,อาทิตย์ | 1054 | 1054 |
33 | dmy | 1 | 0 | norsk (bokmål) | Bokmål | januar,februar,mars,april,mai,juni,juli,august,september,oktober,november,desember | jan,feb,mar,apr,mai,jun,jul,aug,sep,okt,nov,des | mandag,tirsdag,onsdag,torsdag,fredag,lørdag,søndag | 1044 | 1044 |
Levels of Severity
Severity level | Description |
---|---|
0-9 | Informational messages that return status information or report errors that are not severe. The Database Engine does not raise system errors with severities of 0 through 9. |
10 | Informational messages that return status information or report errors that are not severe. For compatibility reasons, the Database Engine converts severity 10 to severity 0 before returning the error information to the calling application. |
11-16 | Indicate errors that can be corrected by the user. |
11 | Indicates that the given object or entity does not exist. |
12 | A special severity for queries that do not use locking because of special query hints. In some cases, read operations performed by these statements could result in inconsistent data, since locks are not taken to guarantee consistency. |
13 | Indicates transaction deadlock errors. |
14 | Indicates security-related errors, such as permission denied. |
15 | Indicates syntax errors in the Transact-SQL command. |
16 | Indicates general errors that can be corrected by the user. |
17-19 | Indicate software errors that cannot be corrected by the user. Inform your system administrator of the problem. |
17 | Indicates that the statement caused SQL Server to run out of resources (such as memory, locks, or disk space for the database) or to exceed some limit set by the system administrator. |
18 | Indicates a problem in the Database Engine software, but the statement completes execution, and the connection to the instance of the Database Engine is maintained. The system administrator should be informed every time a message with a severity level of 18 occurs. |
19 | Indicates that a nonconfigurable Database Engine limit has been exceeded and the current batch process has been terminated. Error messages with a severity level of 19 or higher stop the execution of the current batch. Severity level 19 errors are rare and must be corrected by the system administrator or your primary support provider. Contact your system administrator when a message with a severity level 19 is raised. Error messages with a severity level from 19 through 25 are written to the error log. |
20-24 | Indicate system problems and are fatal errors, which means that the Database Engine task that is executing a statement or batch is no longer running. The task records information about what occurred and then terminates. In most cases, the application connection to the instance of the Database Engine may also terminate. If this happens, depending on the problem, the application might not be able to reconnect. Error messages in this range can affect all of the processes accessing data in the same database and may indicate that a database or object is damaged. Error messages with a severity level from 19 through 24 are written to the error log. |
20 | Indicates that a statement has encountered a problem. Because the problem has affected only the current task, it is unlikely that the database itself has been damaged. |
21 | Indicates that a problem has been encountered that affects all tasks in the current database, but it is unlikely that the database itself has been damaged. |
22 | Indicates that the table or index specified in the message has been damaged by a software or hardware problem. Severity level 22 errors occur rarely. If one occurs, run DBCC CHECKDB to determine whether other objects in the database are also damaged. The problem might be in the buffer cache only and not on the disk itself. If so, restarting the instance of the Database Engine corrects the problem. To continue working, you must reconnect to the instance of the Database Engine; otherwise, use DBCC to repair the problem. In some cases, you may have to restore the database. If restarting the instance of the Database Engine does not correct the problem, then the problem is on the disk. Sometimes destroying the object specified in the error message can solve the problem. For example, if the message reports that the instance of the Database Engine has found a row with a length of 0 in a nonclustered index, delete the index and rebuild it. |
23 | Indicates that the integrity of the entire database is in question because of a hardware or software problem. Severity level 23 errors occur rarely. If one occurs, run DBCC CHECKDB to determine the extent of the damage. The problem might be in the cache only and not on the disk itself. If so, restarting the instance of the Database Engine corrects the problem. To continue working, you must reconnect to the instance of the Database Engine; otherwise, use DBCC to repair the problem. In some cases, you may have to restore the database. |
24 | Indicates a media failure. The system administrator may have to restore the database. You may also have to call your hardware vendor. |
SQL Server Errors
message_id | Description | Article |
---|---|---|
0 | You may see “out of user memory quota” message in errorlog when you use In-Memory OLTP feature … | Out of user memory quota |
0 | Logon Failure: The User has not Been Granted. The operating system returned the error ????? while … | Compressed backup errors |
0 | A transport-level error has occurred when receiving results from the server. | link1 |
0 | The MSSQLSERVER service was unable to log on as SQLAuthoritySQLFarmService with the currently c … | The User has not Been Granted |
0 | A server error occurred on current command. The results, if any, should be discarded. | Who owns your availability groups? |
0 | A network-related issue or instance-specific error occured while establishing a connection to SQL Server | Cannot Connect to SQL Server |
0 | Connecting to Azure SQL Database: Requested tenant identifier ‘00000000-0000-0000-0000-000000000000’ is… | Requested tenant identifier |
102 | Incorrect syntax near ‘%.*ls’. | 102_link1,102_link2 |
120 | The select list for the INSERT statement contains fewer items than the insert list. The number of … | 120_link1 |
121 | The select list for the INSERT statement contains more items than the insert list. The number of … | 121_link1 |
131 | The size (%d) given to the %S_MSG ‘%.*ls’ exceeds the maximum allowed for any data type (%d). | 131_link1 |
145 | ORDER BY items must appear in the select list if SELECT DISTINCT is specified. | 145_link1 |
156 | Incorrect syntax near the keyword ‘ORDER’. | 156_link1 |
207 | Invalid column name ‘%.*ls’. | 207_link1 |
213 | Column name or number of supplied values does not match table definition. | 213_link1,213_link2 |
229 | The %ls permission was denied on the object ‘%.ls’, database ‘%.ls’, schema ‘%.*ls’. | 229_link1 |
241 | Conversion failed when converting date and/or time from character string. | 241_link1 |
257 | Implicit conversion from data type %ls to %ls is not allowed. Use the CONVERT function to run this query | 257_link1 |
264 | The column name ‘%.*ls’ is specified more than once in the SET clause or column list of an INSERT … | 264_link1 |
297 | The user does not have permission to perform this action. | 297_link1 |
352 | The table-valued parameter «%.*ls» must be declared with the READONLY option. | 352_link1 |
459 | Collation ‘%.*ls’ is supported on Unicode data types only and cannot be applied to char, varchar or … | 459_link1 |
535 | The datediff function resulted in an overflow. The number of dateparts separating two date/time | 535_link1 |
596 | Cannot continue execution because the session is in the kill state. | 596_link1,596_link2,596_link3 |
650 | You can only specify the READPAST lock in the READ COMMITTED or REPEATABLE READ isolation levels. | 650_link1 |
657 | Could not disable support for increased partitions in database … | 657_link1 |
666 | The maximum system-generated unique value for a duplicate group was exceeded for index with … | 666_link1 |
701 | There is insufficient system memory in resource pool ‘%ls’ to run this query. … | 701_link1,701_link2 |
824 | SQL Server detected a logical consistency-based I/O error … | 824_link1,824_link2,KB2152734,824_link3 |
825 | The operating system returned error %ls to SQL Server. It failed creating event for a %S_MSG at … | 825_link1 |
913 | Could Not Find Database %d. Database May Not be Activated Yet or May be in Transition … | 913_link1 |
922 | Database ‘%.*ls’ is being recovered. Waiting until recovery is finished. | 922_link1 |
926 | Database ‘%.*ls’ cannot be opened. It has been marked SUSPECT by recovery. See the SQL Server errorlog … | 926_link1 |
1052 | Conflicting %ls options «%ls» and «%ls». | 1052_link1 |
1065 | The NOLOCK and READUNCOMMITTED lock hints are not allowed for target tables of INSERT, UPDATE, DELETE … | 1065_link1 |
1105 | Could not allocate space for object ‘%.ls’%.ls in database ‘%.ls’ because the ‘%.ls’ filegroup is … | 1105_link1 |
1204 | The instance of the SQL Server Database Engine cannot obtain a LOCK resource at this time. Rerun your … | 1204_link1 |
1205 | Transaction (Process ID %d) was deadlocked on %.*ls resources with another process and has been chosen … | 1205_link1 |
1222 | Lock request time out period exceeded. | 1222_link1 |
1219 | Your session has been disconnected because of a high priority DDL operation. | 1219_link1 |
1480 | The %S_MSG database «%.*ls» is changing roles from «%ls» to «%ls» because the mirroring session or … | 1480_link1 |
1701 | Creating or altering table %ls failed because the minimum row size would be 8061, including 10 b … | 1701_link1 |
1807 | Could not obtain exclusive lock on database ‘model’. Retry the operation later. … | 1807_link1 |
1904 | The statistics on table has 65 columns in the key list … | 1904_link1 |
1908 | Column ‘%.ls’ is partitioning column of the index ‘%.ls’. Partition columns for a unique index … | 1908_link1 |
2533 | Table error: page %S_PGID allocated to object ID %d, index ID %d, partition ID %I64d, alloc unit ID … | 2533_link1 |
2534 | Table error: page %S_PGID, whose header indicates that it is allocated to object ID %d, index ID %d, … | 2534_link1 |
2812 | Could not find stored procedure ‘%.*ls’. | 2812_link1 |
3101 | Exclusive access could not be obtained because the database is in use. … | 3101_link1 |
3154 | The backup set holds a backup of a database other than the existing … | 3154_link1 |
3241 | The media family on device ‘%ls’ is incorrectly formed. SQL Server cannot process this media fam … | 3241_link1 |
3314 | During undoing of a logged operation in database ‘%.*ls’, an error occurred at log record ID %S … | 3314_link1 |
3634 | The operating system returned the error ‘%ls’ while attempting ‘%ls’ on ‘%ls’. … | 3634_link1 |
3637 | A parallel operation cannot be started from a DAC connection. | 3637_link1 |
3743 | The database ‘%.*ls’ is enabled for database mirroring. Database mirroring must be removed befor … | 3743_link1 |
3906 | Failed to update database «%.*ls» because the database is read-only. | 3906_link1 |
3930 | The current transaction cannot be committed and cannot support operations that write to the log … | 3930_link1 |
3956 | Snapshot isolation transaction failed to start in database ‘%.*ls’ because the ALTER DATABASE command … | 3956_link1 |
3960 | Snapshot isolation transaction aborted due to update conflict. You cannot use snapshot isolation to … | 3960_link1 |
4064 | Cannot open user default database. Login failed.Login failed. … | 4064_link1 |
4189 | Cannot convert to text/ntext or collate to ‘%.*ls’ because these legacy LOB types do not support UTF-8 … | 4189_link1 |
4353 | Conflicting file relocations have been specified for file ‘%.*ls’. Only a single WITH MOVE clause … | 4353_link1 |
4629 | Permissions on server scoped catalog views or system stored procedures or extended stored … | 4629_link1 |
4901 | ALTER TABLE only allows columns to be added that can contain nulls, or have a DEFAULT definition … | 4901_link1 |
4922 | ALTER TABLE ALTER COLUMN Address failed because one or more objects access this column. … | 4922_link1 |
4934 | Computed column ‘%.ls’ in table ‘%.ls’ cannot be persisted because the column does user or … | 4934_link1 |
4947 | ALTER TABLE SWITCH statement failed. There is no identical index in source table ‘%.*ls’ for the … | 4947_link1 |
5004 | To use ALTER DATABASE, the database must be in a writable state in which a checkpoint can be executed. | 5004_link1 |
5011 | User does not have permission to alter database ‘%.*ls’, the database does not exist, or the database … | 5011_link1 |
5061 | ALTER DATABASE failed because a lock could not be placed on database ‘%.*ls’. Try again later. | 5061_link1 |
5084 | Setting database option %ls to %ls for database ‘%.*ls’. | 5084_link1 |
5120 | Unable to open the physical file … Operating system error 5: «5(Access is denied.)» … | SQL SERVER — FIX Error 5120 |
5123 | CREATE FILE encountered operating system error «%ls»(The system cannot find the path specified.) … | 5123_link1, 5123_link2 |
5171 | %.*ls is not a primary database file. | 5171_link1 |
5172 | The header for file ‘%ls’ is not a valid database file header. The %ls property is incorrect. | 5172_link1 |
5235 | %lsDBCC %ls (%ls%ls%ls)%ls executed by %ls terminated abnormally due to error state %d. Elapsed time: … | 5235_link1 |
5846 | Common language runtime (CLR) execution is not supported under lightweight pooling. Disable one of two … | 5846_link1 |
6335 | XML datatype instance has too many levels of nested nodes. Maximum allowed depth is 128 levels. | 6335_link1 |
6348 | Specified collection ‘%.*ls’ cannot be created because it already exists or you do not have permission. | 6348_link1 |
6401 | Cannot roll back %.*ls. No transaction or savepoint of that name was found. | 6401_link1 |
7341 | Cannot get the current row value of column «%ls.%ls» from OLE DB provider «%ls» for linked server «%ls … | 7341_link1 |
7344 | The OLE DB provider «%ls» for linked server «%ls» could not %ls table «%ls» because of column … | 7344_link1 |
7356 | The OLE DB provider «%ls» for linked server «%ls» supplied inconsistent metadata for a column. … | 7356_link1 |
7357 | Cannot process the object «%ls». The OLE DB provider «%ls» for linked server «%ls» indicates that … | 7357_link1, 7357_link2 |
7391 | The operation could not be performed because OLE DB provider «%ls» for linked server «%ls» … … | 7391_link2 |
7719 | CREATE/ALTER partition function failed as only maximum of 1000 partitions can be created. … | 657_link1 |
7926 | Check statement aborted. The database could not be checked as a database snapshot could not be created … | 7926_link1 |
8101 | An explicit value for the identity column in table ‘%.*ls’ can only be specified when a column list is … | 8101_link1 |
8107 | IDENTITY_INSERT is already ON for table ‘%.ls.%.ls.%.*ls’. Cannot perform SET operation for table ‘% … | 8107_link1 |
8115 | Arithmetic overflow error converting %ls to data type %ls. | 8115_link1 |
8116 | Argument data type %ls is invalid for argument %d of %ls function. | 8116_link1 |
8117 | Operand data type %ls is invalid for %ls operator. | 8117_link1 |
8180 | Statement(s) could not be prepared. | 8180_link1 |
8127 | Column «%.ls.%.ls» is invalid in the ORDER BY clause because it is not contained in either an … | 8127_link1 |
8152 | String or binary data would be truncated. | 8152_link1 |
8624 | Internal Query Processor Error: The query processor could not produce a query plan. | 8624_link1 |
8645 | A timeout occurred while waiting for memory resources to execute the query in resource pool ‘%ls’ (%ld … | 8645_link1 |
8651 | Could not perform the operation because the requested memory grant was not available in resource … | 8651_link1 |
8672 | The MERGE statement attempted to UPDATE or DELETE the same row more than once… … | 8672_link1 |
8909 | Table error: Object ID %d, index ID %d, partition ID %I64d, alloc unit ID %I64d (type %.*ls), pa … | 8909_link1 |
8921 | Check terminated. A failure was detected while collecting facts. Possibly tempdb out of space or … | 8921_link1 |
8928 | Object ID %d, index ID %d, partition ID %I64d, alloc unit ID %I64d (type %.*ls): Page %S_PGID could not… | 8928_link1 |
8939 | Table error: Object ID %d, index ID %d, partition ID %I64d, alloc unit ID %I64d (type %.*ls), page … | 8939_link1 |
8948 | Database error: Page %S_PGID is marked with the wrong type in PFS page %S_PGID. PFS status 0x%x … | 8948_link1 |
9001 | The log for database ‘%.*ls’ is not available. Check the operating system error log for related … | 9001_link1 |
9002 | The transaction log for database ‘%ls’ is full due to ‘%ls’. … | 9002_link1,9002_link2,9002_link3 |
9105 | The provided statistics stream is corrupt. | 9105_link1 |
9642 | An error occurred in a Service Broker/Database Mirroring transport connection endpoint, Error: %i, … | 9105_link1 |
10314 | An error occurred in the Microsoft .NET Framework while trying to load assembly id %d. The server may … | 10314_link1,10314_link2 |
10637 | Cannot perform this operation on ‘%.*ls’ with ID %I64d as one or more indexes are currently in … | 10637_link1 |
10794 | The %S_MSG ‘%ls’ is not supported with %S_MSG. | 10794_link1,10794_link2 |
11442 | Columnstore index creation is not supported in tempdb when memory-optimized metadata mode is enabled. … | [11442_link1][51] |
11535 | EXECUTE statement failed because its WITH RESULT SETS clause specified %d result set(s), and the … | 11535_link1 |
12349 | Operation not supported for memory optimized tables having columnstore index. | 12349_link1 |
13609 | JSON text is not properly formatted. Unexpected character ‘%lc’ is found at position %d. | 13609_link1 |
13515 | Setting SYSTEM_VERSIONING to ON failed because history table ‘%.*ls’ has custom unique keys defined. … | 13515_link1 |
13518 | Setting SYSTEM_VERSIONING to ON failed because history table ‘%.*ls’ has IDENTITY column specification … | 13518_link1 |
13523 | Setting SYSTEM_VERSIONING to ON failed because table ‘%.ls’ has %d columns and table ‘%.ls’ has %d … | 13523_link1 |
13543 | Setting SYSTEM_VERSIONING to ON failed because history table ‘%.*ls’ contains invalid records with end … | 13543_link1 |
13570 | The use of replication is not supported with system-versioned temporal table ‘%s’ | 13570_link1 |
13573 | Setting SYSTEM_VERSIONING to ON failed because history table ‘%.*ls’ contains overlapping records. | 13573_link1 |
13575 | ADD PERIOD FOR SYSTEM_TIME failed because table ‘%.*ls’ contains records where end of period is not … | 13575_link1 |
13901 | Identifier ‘%.*ls’ in a MATCH clause is not a node table or an alias for a node table. | 13901_link1 |
13902 | Identifier ‘%.*ls’ in a MATCH clause is not an edge table or an alias for an edge table. | 13902_link1 |
15002 | The procedure ‘sys.sp_dbcmptlevel’ cannot be executed within a transaction. … | 15002_link1 |
15021 | Invalid value given for parameter %s. Specify a valid parameter value. | 15021_link1 |
15136 | The database principal is set as the execution context of one or more procedures, functions, … | 15136_link1 |
15190 | There are still remote logins or linked logins for the server ‘%s’. | 15190_link1 |
15199 | The current security context cannot be reverted. Please switch to the original database where … | 15199_link1 |
15274 | Access to the remote server is denied because the current security context is not trusted. | 15274_link1 |
15404 | Could not obtain information about Windows NT group/user ‘%ls’, error code %#lx. | 15404_link1 |
15406 | Cannot execute as the server principal because the principal «%.*ls» does not exist, this type of … | 15406_link1 |
15457 | Configuration option ‘%ls’ changed from %ld to %ld. Run the RECONFIGURE statement to install. | 5457_link1 |
17051 | SQL Server evaluation edition has expired. | 17051_link1 |
17182 | TDSSNIClient initialization failed with error 0x%lx, status code 0x%lx. Reason: %S_MSG %.*ls | 17182_link1 |
17190 | Initializing the FallBack certificate failed with error code: %d, state: %d, error number: %d. … | 17190_link1 |
17300 | SQL Server was unable to run a new system task, either because there is insufficient memory or the … | 17300_link1 |
17836 | Length specified in network packet payload did not match number of bytes read; the connection has been … | 17836_link1 |
18054 | Error %d, severity %d, state %d was raised, but no message with that error number was found in … | 18054_link1 |
18272 | During restore restart, an I/O error occurred on checkpoint file ‘%s’ (operating system error %s … | 18272_link1 |
18357 | Reason: An attempt to login using SQL authentication failed. Server is configured for Integrated … | 18357_link1 |
18401 | Login failed for user ‘%.*ls’. Reason: Server is in script upgrade mode. Only administrator can connect… | 18401_link1 |
18452 | Login failed. The login is from an untrusted domain and cannot be used with Windows authenticati … | 18452_link1 |
18456 | Login failed for user ‘%.ls’.%.ls%.*ls | 18456_link1 |
20598 | The row was not found at the Subscriber when applying the replicated %S_MSG command for Table ‘%s’ with… | 20598_link1 |
22911 | The capture job cannot be used by Change Data Capture to extract changes from the log when … | 22911_link1 |
25713 | The value specified for %S_MSG, «%.ls», %S_MSG, «%.ls», is invalid. | 25713_link1,25713_link2 |
26023 | Server TCP provider failed to listen on [ %s <%s> %d]. Tcp port is already in use. | 26023_link1 |
33111 | Cannot find server %S_MSG with thumbprint ‘%.*ls’. | 33111_link1 |
33206 | SQL Server Audit failed to create the audit file ‘%s’. Make sure that the disk is not full and … | 33206_link1 |
35217 | The thread pool for Always On Availability Groups was unable to start a new worker thread because … | [35217_link1] |
35250 | The connection to the primary replica is not active. The command cannot be processed. | 35250_link1 |
35264 | Always On Availability Groups data movement for database ‘%.*ls’ has been suspended for the following … | 35264_link1 |
35320 | Column store indexes are not allowed on tables for which the durability option SCHEMA_ONLY is specified. | 35320_link1 |
35337 | UPDATE STATISTICS failed because statistics cannot be updated on a columnstore index. … | 35337_link1 |
35343 | The statement failed. Column ‘%.*ls’ has a data type that cannot participate in a columnstore index. | 35343_link1 |
39004 | A ‘%s’ script error occurred during execution of ‘sp_execute_external_script’ with HRESULT 0x%x. | 39004_link1 |
41121 | The local availability replica of availability group ‘%.*ls’ cannot accept signal ‘%s’ in its current … | 41121_link1 |
41317 | A user transaction that accesses memory optimized tables or natively compiled modules cannot access more… | [41317_link1][51] |
41922 | The backup operation for a database with service-managed transaprent data encryption is not supported on… | 41922_link1 |
[51]:
[35217_link1] :https://www.seangallardy.com/error-35217-and-availability-groups-smh/
In SQL Server a full error message for T-SQL consists of four parts normally. To outline the parts in messages consider following sample error message
Msg 207, Level 16, State 1, Line 1
Invalid column name ‘count’.
- Msg is message number, or it may be said error number. It is unique to every error description statement. If the error occurs in a stored procedure or trigger, it returns the line number in the routine.
- Level is severity level of error message from 0 to 25. It points towards nature of error and its severity.
- State is integer value between 1 and 127. It points to source of error message. The values for this parameter are specific to error message and are not documented by Microsoft.
- Line points to line number in code that generated the error. The line may not be the exact line produced the error. In that case you may examine the control flow to detect exact source of error.
In second line there is error description statement that briefly describes the produced error.
If error occurred in set of defined T-SQL statements like stored procedures, functions etc. Then name of that source may also be included in full error message.
Among the above mentioned parts of a full error message, after the error statement itself, level is important information that helps to trouble shoot the error. Some error statements makes no idea without considering the associated error severity level. So how to get error severity levels summary to use these while trouble shooting T-SQL statements?
Severity level of errors range from 0 to 25. I will summarize the description of error levels at reasonable level of abstraction.
Level 00 – 09
These messages are not errors but just informational messages produced
by SQL Server Engine.
Level 10
These are also informational messages but report errors that are not severe and does not threat the execution. For sake of compatibility reasons, the Database Engine converts severity 10 to severity 0 before returning the error information to the calling application.
Level 11
Indicates that the given object or entity does not exist.
Level 12
A special severity for queries that do not use locking because of special hints provided in query. In some cases, read operations performed by these statements could result in inconsistent data due to fact that locking mechanism is not applied.
Level 13
Indicates errors due to transaction deadlock.
Level 14
Indicates permission and security-related errors, such as permission denied.
Level 15
Indicates presence of syntax errors in the Transact-SQL command.
Level 16
Indicates general errors that can be corrected by the user.
Level 17
Produced when of SQL Server becomes short of configurable resources. Example of such resources may be SQL Server locks, memory and disk space.
Level 18
roduced due to internal software problem in database engine. Statement is executed and connection to SQL Server engine is maintained. BOL recommends that system admin should be informed in case of an error with severity level 18.
Level 19
Produced when SQL Server becomes short of non configurable resources. Execution of current batch is terminated. These errors are written in error log.
Level 20
Produced by any problem with statement issued by the current process. Over all environment of SQL Server is not threatened except the related process. Errors of this level are also written in error log.
Level 21
Produced when an error occurs that affects all the processes of that specific database in SQL Server. Mostly it is unlikely that database itself is damaged. Errors of this level is also written in error log.
Level 22
Indicates the damage of an index or table. The problem may be in cache or on disk. If problem is on cache then just restart of SQL Server will work. If problem is on disk then use maintenance and trouble shooting commands to detect and fix the problems.
Level 23
Indicates that specific database is corrupt to some extent. Use commands to fix the problems. reason of corruption may be hard ware or software related.
Level 24
Indicates that a hardware problem occurs. You have to restore the database
and hard ware vendor may also be contacted in this case.
Level 25
Indicates that some type of system level error has occurred
Understanding and using the severity level concept along with error statement produced helps allot to efficiently detect and fix the errors. To have a complete default list of SQL Server error number, severity level and error description use following commands for SQL Server 2000, SQL Server 2005 and SQL Server 2008.
/* Command to get default list of SQL Server error numbers and descriptions */ —For SQL Server 2000 USE Master SELECT * FROM SysMessages GO — For SQL Server 2005, 2008 USE Master SELECT * FROM SysMessages WHERE MsgLangId = 1033 GO |
In case of SQL Server 2000 value for ‘MsgLangID’ is not required because it returns default language only. While SQL Server 2005 returns all language so you have to provide language ID as in this case we have provided for English. To get list of all languages and their IDs in SQL Server 2005 execute following T-SQL command.