T-SQL Tutorial

Error messages - TSQL Tutorial

The Transact SQL language show you various error messages when the code is written wrong, when we have incorrect syntax in the statement or when we don't have enough rights.

MsgLevelError messages
10416Order By items must appear in the select list
10915There are more columns in the INSERT statement than values specified in the VALUES clause
11015There are fewer columns in the INSERT statement
12015 The select list for the INSERT statement contains fewer items than the insert list.
12115 The select list for the INSERT statement contains more items than the insert list.
13715Must declare the scalar variable
15515Is not a recognized datepart option
15915Must specify the table name and index name
17315The definition for column must include a data type
19515Is not a recognized built-in function name
20116Procedure or function 'sp_pkeys' expects parameter '@table_name', which was not supplied
20716Invalid column name
20616Operand type clash: int is incompatible with date
20816Invalid object name
24116Conversion failed when converting date and/or time from character string
24216Conversion of a varchar data type to a datetime
24316Is not a defined system type
24516Conversion failed when converting the varchar value
34315Unknown object type used in a CREATE, DROP, or ALTER statement
51516Cannot insert the value NULL into column
54416Cannot insert explicit value for identity column in table
54716The INSERT statement conflicted with the FOREIGN KEY constraint
54716The DELETE statement conflicted with the REFERENCE constraint
100216Specified scale is invalid
108716Must declare the table variable
150516The CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name
175016Could not create constraint or index
177016Foreign key references invalid column in referenced table
177616There are no primary or candidate keys in the referenced table
177916Table already has a primary key defined on it
191116Column name does not exist in the target table or view
191316The operation failed because an index
262714Violation of PRIMARY KEY constraint
270516Column names in each table must be unique
271416There is already an object named in the database
271516Cannot find data type NUMBER
281216Could not find stored procedure
370111Cannot drop the table
372616Could not drop object because it is referenced by a FOREIGN KEY constraint
372816Is not a constraint
390216Msg 3902 Level 16 - The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION
451116Create View or Function failed because no column name was specified
811116Cannot define PRIMARY KEY constraint on nullable column in table
812016Column is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause
815216String or binary data would be truncated
1500916The object name does not exist
1525016The database name component of the object qualifier must be the name of the current database
1525216The primary or foreign key table name must be given
1522511No item by the name of '%' could be found in the current database.