Skip to content

SQL Server Error Messages

  • Error Message 104


    ORDER BY items must appear in the select list if the statement contains a UNION operator.

  • Error Message 107


    The column prefix does not match with a table name or alias name used in the query.

  • Error Message 108


    The ORDER BY position number is out of range of the number of items in the select list.

  • Error Message 109


    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 number of columns specified in the INSERT statement.

  • Error Message 110


    There are fewer columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement.

  • Error Message 111


    'CREATE FUNCTION' must be the first statement in a query batch.

  • Error Message 113


    Missing end comment mark '*/'.

  • Error Message 116


    Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.

  • Error Message 117


    The object name 'Object Name' contains more than the maximum number of prefixes. The maximum is 2.

  • Error Message 119


    Must pass parameter number 2 and subsequent parameters as '@name = value'. After the form '@name = value' has been used, all subsequent parameters must be passed in the form '@name = value'.

  • Error Message 120


    The select list for the INSERT statement contains fewer items than the insert list. The number of SELECT values must match the number of INSERT columns.

  • Error Message 121


    The select list for the INSERT statement contains more items than the insert list. The number of SELECT values must match the number of INSERT columns.

  • Error Message 127


    A TOP N value may not be negative.

  • Error Message 128


    The name <Column Name> is not permitted in this context.
    Only constants, expressions, or variables allowed here. Column names are not permitted.

  • Error Message 130


    Cannot perform an aggregate function on an expression containing an aggregate or a subquery.

  • Error Message 131


    The size (<Data Type Size>) given to the type 'varchar / char / nvarchar / nchar / binary / varbinary' exceeds the maximum allowed for any data type (8000). The size (<Data Type Size>) given to the column <Column Name> exceeds the maximum allowed for any data type (8000).

  • Error Message 133


    A GOTO statement references the label '

  • Error Message 134


    The variable name <Variable Name> has already been declared. Variable names must be unique within a query batch or stored procedure.

  • Error Message 135


    Cannot use a BREAK statement outside the scope of a WHILE statement.

  • Error Message 136


    Cannot use a CONTINUE statement outside the scope of a WHILE statement.

  • Error Message 137


    Must declare the scalar variable <Variable Name>.

  • Error Message 139


    Cannot assign a default value to a local variable.

  • Error Message 140


    Can only use IF UPDATE within a CREATE TRIGGER statement.

  • Error Message 141


    A SELECT statement that assigns a value to a variable must not be combined with data-retrieval operations.

  • Error Message 145


    ORDER BY items must appear in the select list if SELECT DISTINCT is specified.

  • Error Message 147


    An aggregate may not appear in the WHERE clause unless it is in a subquery contained in a HAVING clause or a select list, and the column being aggregated is an outer reference.

  • Error Message 148


    Incorrect time syntax in time string <Wait Time> used with WAITFOR.

  • Error Message 154


    a COMPUTE clause is not allowed in a SELECT INTO statement.

  • Error Message 155


    <Option> is not a recognized DATEADD option.

  • Error Message 157


    An aggregate may not appear in the set list of an UPDATE statement.

  • Error Message 158


    An aggregate may not appear in the OUTPUT clause.

  • Error Message 159


    Must specify the table name and index name for the DROP INDEX statement. For DROP INDEX, you must give both the table and the index name, in the form tablename.indexname.

  • Error Message 160


    Procedure <Rule Name>, Line 1. Rule does not contain a variable.

  • Error Message 161


    Procedure <Rule Name>, Line 1 Rule contains more than one variable.

  • Error Message 164


    Each GROUP BY expression must contain at least one column that is not an outer reference.

  • Error Message 166


    'CREATE VIEW' does not allow specifying the database name as a prefix to the object name.

  • Error Message 169


    A column has been specified more than once in the order by list. Columns in the order by list must be unique.

  • Error Message 173


    The definition of column <Column Name> must include a data type.

  • Error Message 174


    The dateadd function requires 3 argument(s).

  • Error Message 177


    The IDENTITY function can only be used when the SELECT statement has an INTO clause.

  • Error Message 181


    Cannot use the OUTPUT option in a DECLARE, CREATE AGGREGATE or CREATE FUNCTION statement.

  • Error Message 183


    The scale (<Scale Value>) for column <Column Name> must be within the range 0 to <Precision Value>.

  • Error Message 192


    The scale must be less than or equal to the precision.

  • Error Message 194


    A SELECT INTO statement cannot contain a SELECT statement that assigns values to a variable.

  • Error Message 195


    Function Name is not a recognized function name.

  • Error Message 196


    SELECT INTO must be the first query in a statement containing a UNION, INTERSECT or EXCEPT operator.

  • Error Message 197


    EXECUTE cannot be used as a source when inserting into a table variable.

  • Error Message 199


    An INSERT statement cannot contain a SELECT statement that assigns values to a variable.

  • Error Message 201


    Procedure or function '<Procedure Name>' expects parameter '<Parameter Name>', which was not supplied.

  • Error Message 205


    All queries in an SQL statement containing a UNION operator must have an equal number of expressions in their target lists.

  • Error Message 209


    Ambiguous column name '<Column Name>'.

  • Error Message 210


    Conversion failed when converting datetime from binary / varbinary string.

  • Error Message 213


    Insert Error: Column name or number of supplied values does not match table definition.

  • Error Message 217


    Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32).

  • Error Message 234


    There is insufficient result space to convert a money value to varchar / nvarchar / char / nchar.

  • Error Message 235


    Cannot convert a char value to money. The char value has incorrect syntax.

  • Error Message 237


    There is insufficient result space to convert a money value to varchar / nvarchar / char / nchar.

  • Error Message 240


    Types don't match between the anchor and the recursive part in column "<Column Name>" of recursive query "<Recursive Common-Table Expression Name>".

  • Error Message 242


    The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.

  • Error Message 243


    Type XML is not a defined system type. Type GEOMETRY | GEOGRAPHY is not a defined system type. Type DATE | TIME | DATETIME2 | DATETIMEOFFSET is not a defined system type.

  • Error Message 245


    Syntax error converting the varchar value to a column of data type int.

  • Error Message 248


    The conversion of the varchar value overflowed an int column. Maximum integer value exceeded.

  • Error Message 252


    Recursive common table expression '<CTE Name>' does not contain a top-level UNION ALL operator.

  • Error Message 253


    Recursive member of a common table expression '<Common Table Expression>' has multiple recursive references.

  • Error Message 256


    The data type int is invalid for the substring function. Allowed types are: char/varchar, nchar/nvarchar, and binary/varbinary.

  • Error Message 263


    Must specify table to select from.

  • Error Message 271


    The column <Column Name> cannot be modified because it is either a computed column or is the result of a UNION operator. Column <Column Name> cannot be modified because it is a computed column.

  • Error Message 272


    Cannot update a timestamp column.

  • Error Message 273


    Cannot insert an explicit value into a timestamp column. Use INSERT with a column list to exclude the timestamp column, or insert a DEFAULT into the timestamp column.

  • Error Message 281


    <Style number> is not a valid style number when converting from datetime to a character string.

  • Error Message 292


    There is insufficient result space to convert a smallmoney value to varchar/nvarchar.

  • Error Message 293


    Cannot convert a char value to smallmoney. The char value has incorrect syntax.

  • Error Message 294


    The conversion from char data type to smallmoney data type resulted in a smallmoney overflow error.

  • Error Message 295


    Conversion failed when converting character string to smalldatetime data type.

  • Error Message 296


    The conversion of char data type to smalldatetime data type resulted in an out-of-range smalldatetime value.

  • Error Message 298


    The conversion from datetime data type to smalldatetime data type resulted in a smalldatetime overflow error.

  • Error Message 302


    The newsequentialid() built-in function can only be used in a DEFAULT expression for a column of type 'uniqueidentifier' in a CREATE TABLE or ALTER TABLE statement. It cannot be combined with other operators to form a complex scalar expression.

  • Error Message 305


    The XML data type cannot be compared or sorted, except when using the IS NULL operator.

  • Error Message 306


    The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator.

  • Error Message 310


    The value <MAXRECURSION Value> specified for the MAXRECURSION option exceeds the allowed maximum of 32767.

  • Error Message 313


    An insufficient number of arguments were supplied for the procedure or function Stored Procedure or Function Name.

  • Error Message 317


    Table-valued function '<Function Name>' cannot have a column alias.

  • Error Message 330


    The target '<Object Name>' of the OUTPUT INTO clause cannot be a view or common table expression.

  • Error Message 331


    The target table '<Table Name>' of the OUTPUT INTO clause cannot have any enabled triggers.

  • Error Message 332


    The target table '<Table Name>' of the OUTPUT INTO clause cannot be on either side of a (primary key, foreign key) relationship. Found reference constraint '<Primary Key or Foreign Key Constraint Name>'.

  • Error Message 333


    The target table '<Table Name>' of the OUTPUT INTO clause cannot have any enabled check constraints or any enabled rules.
    Found check constraint or rule '<Check Constraint Name>'.

  • Error Message 334


    The target table '<Table Name>' of the DML statement cannot have any enabled triggers if the statement contains an OUTPUT clause without INTO clause.

  • Error Message 339


    DEFAULT or NULL are not allowed as explicit identity values.

  • Error Message 346


    The parameter "<Parameter Name>" can not be declared READONLY since it is not a table-valued parameter.

  • Error Message 352


    The table-valued parameter must be declared with the READONLY option.

  • Error Message 355


    The target table '<Table Name>' of the INSERT statement cannot have any enabled triggers when the FROM clause contains a nested INSERT, UPDATE, DELETE, or MERGE statement.

  • Error Message 356


    The target table '<Table Name>' of the INSERT statement cannot be on either side of a (primary key, foreign key) relationship when the FROM clause contains a nested INSERT, UPDATE, DELETE, or MERGE statement. Found reference constraint '<Primary Key or Foreign Key Constraint Name>'.

  • Error Message 403


    Invalid operator for data type. Operator equals add, type equals text.

  • Error Message 420


    The text, ntext, and image data types cannot be used in an ORDER BY clause.

  • Error Message 421


    The text/ntext/image data type cannot be selected as DISTINCT because it is not comparable.

  • Error Message 443 - GETDATE


    Invalid use of 'getdate' within a function.

  • Error Message 443 - INSERT


    Invalid use of 'INSERT' within a function.

  • Error Message 443 - UPDATE


    Invalid use of 'UPDATE' within a function.

  • Error Message 444


    Select statements included within a function cannot return data to a client.

  • Error Message 455


    The last statement included within a function must be a return statement.

  • Error Message 460


    DISTINCT operator is not allowed in the recursive part of a recursive common table expression '<Common Table Expression Name>'.

  • Error Message 461


    DISTINCT operator is not allowed in the recursive part of a recursive common table expression '<Common Table Expression Name>'.

  • Error Message 462


    Outer join is not allowed in the recursive part of a recursive common table expression '<Common Table Expression Name>'.

  • Error Message 467


    GROUP BY, HAVING, or aggregate functions are not allowed in the recursive part of a recursive common table expression '<CTE Name>'.

  • Error Message 470


    The synonym "<Synonym Name>" referenced synonym "<Synonym Name>". Synonym chaining is not allowed.

  • Error Message 476


    Invalid PERCENT tablesample size "<sample_number>" for table "<Table Name>". The PERCENT tablesample size must be between 0 and 100.

  • Error Message 477


    Invalid ROWS value or REPEATABLE seed in the TABLESAMPLE clause for table "<Table Name>". The value or seed must be an integer.

  • Error Message 478


    The TABLESAMPLE clause cannot be used in a view definition or inline table function definition.

  • Error Message 479


    Invalid ROWS value or REPEATABLE seed "<Sample Number>" in the TABLESAMPLE clause for table <Table Name>. The value or seed must be greater than 0.

  • Error Message 483


    The OUTPUT clause cannot be used in an INSERT...EXEC statement.

  • Error Message 494


    The TABLESAMPLE clause can only be used with local tables.

  • Error Message 497


    Variables are not allowed in the TABLESAMPLE or REPEATABLE clauses.

  • Error Message 515


    Cannot insert the value NULL into column 'Column Name', table 'Table Name'; column does not allow nulls. INSERT fails.

  • Error Message 536


    Invalid length parameter passed to the substring function.

  • Error Message 537


    Invalid length parameter passed to the LEFT or SUBSTRING function.

  • Error Message 544


    Cannot insert explicit value for identity column in table Table Name when IDENTITY_INSERT is set to OFF.

  • Error Message 545


    Explicit value must be specified for identity column in table '<Table Name>' either when IDENTITY_INSERT is set to ON or when a replication user is inserting into a NOT FOR REPLICATION identity column.

  • Error Message 547 - ALTER TABLE


    ALTER TABLE statement conflicted with COLUMN FOREIGN KEY constraint 'Constraint Name'. The conflict occurred in database 'Database Name', table 'Table Name', column 'Column Name'.

  • Error Message 547 - INSERT


    INSERT statement conflicted with COLUMN FOREIGN KEY constraint Constraint Name. The conflict occurred in database Database Name, table Table Name, column Column Name.

  • Error Message 547 - DELETE


    DELETE statement conflicted with COLUMN REFERENCE constraint Constraint Name. The conflict occurred in database Database Name, table Table Name, column Column Name.

  • Error Message 547 - UPDATE


    UPDATE statement conflicted with COLUMN REFERENCE constraint Foreign Key Constraint Name. The conflict occurred in database Database Name, table Table Name, column Column Name.

  • Error Message 1008


    The SELECT item identified by the ORDER BY number 1 contains a variable as part of the expression identifying a column position. Variables are only allowed when ordering by an expression referencing a column name.

  • Error Message 1013


    The objects "Object Name" and "Object Name" in the FROM clause have the same exposed names. Use correlation names to distinguish them.

  • Error Message 1054


    Syntax '*' is not allowed in schema-bound objects.

  • Error Message 1062


    The TOP N WITH TIES clause is not allowed without a corresponding ORDER BY clause.

  • Error Message 1077


    INSERT into an identity column not allowed on table variables.

  • Error Message 1753


    Column 'Table.Primary Key' is not the same length as referencing column 'Referencing Table.Referencing Column' in foreign key 'Foreign Key Constraint Name'.

  • Error Message 1776


    There are no primary or candidate keys in the referenced table 'Table Name' that match the referencing column list in the foreign key 'Foreign Key Constraint Name'

  • Error Message 1778


    Column 'Primary Table.Primary Key' is not the same data type as referencing column 'Referencing Table.Referencing Column' in foreign key 'Foreign Key Constraint Name'.

  • Error Message 1781


    Column already has a DEFAULT bound to it.

  • Error Message 1902


    Cannot create more than one clustered index on table 'Table Name'. Drop the existing clustered index 'Clustered Index Name' before creating another.

  • Error Message 1939


    Cannot create index on view '<View Name>' because the view is not schema bound.

  • Error Message 1940


    Cannot create index on view ''. It does not have a unique clustered index.

  • Error Message 2601


    Cannot insert duplicate key row in object '<Object Name>' with unique index '<Index Name>'.

  • Error Message 2627


    Violation of PRIMARY KEY constraint Constraint Name. Cannot insert duplicate key in object Table Name.

  • Error Message 2739


    The text, ntext, and image data types are invalid for local variables.

  • Error Message 3729


    The text, ntext, and image data types are invalid for local variables.

  • Error Message 4104


    The multi-part identifier could not be bound.

  • Error Message 4502


    View or function 'View or Function Name' has more column names specified than columns defined.

  • Error Message 4506


    Column names in each view or function must be unique. Column name '<Column Name>' in view or function '<View or Function Name>' is specified more than once.

  • Error Message 4511


    Create View or Function failed because no column name was specified for column <Column Number>.

  • Error Message 4512


    Cannot schema bind view '<View Name>' because name '<Table Name>' is invalid for schema binding. Names must be in two-part format and an object cannot reference itself.

  • Error Message 4514


    CREATE FUNCTION failed because a column name is not specified for column <Column Number>.

  • Error Message 4712


    Cannot truncate table '<Table Name>' because it is being referenced by a FOREIGN KEY constraint.

  • Error Message 4901


    ALTER TABLE only allows columns to be added that can contain nulls, or have a DEFAULT definition specified, or the column being added is an identity or timestamp column, or alternatively if none of the previous conditions are satisfied the table must be empty to allow addition of this column. Column '<Column Name>' cannot be added to non-empty table '<Table Name>' because it does not satisfy these conditions.

  • Error Message 4928


    Cannot alter column <Column Name> because it is COMPUTED.

  • Error Message 5074


    The object 'Primary Key Constraint Name' is dependent on column 'Primary Key Column Name'. ALTER TABLE ALTER COLUMN Column Name failed because one or more objects access this column.

  • Error Message 7325


    Objects exposing columns with CLR types are not allowed in distributed queries. Please use a pass-through query to access remote object '<Object Name>'.

  • Error Message 8101


    An explicit value for the identity column in table "Table Name" can only be specified when a column list is used and IDENTITY_INSERT is ON.

  • Error Message 8102


    Cannot update identity column 'Column Name'.

  • Error Message 8106


    Table '<Table Name>' does not have the identity property. Cannot perform SET operation.

  • Error Message 8107


    IDENTITY_INSERT is already ON for table Table Name. Cannot perform SET operation for table Table Name.

  • Error Message 8108


    Cannot add identity column, using the SELECT INTO statement, to table '<Table Name>', which already has column '<Column Name>' that inherits the identity property.

  • Error Message 8110


    Cannot add multiple PRIMARY constraints to table '<Table Name>'.

  • Error Message 8111


    Cannot define PRIMARY KEY constraint on nullable column in table 'Table Name'.

  • Error Message 8115 - NUMERIC to NUMERIC


    Arithmetic overflow error converting numeric to data type numeric.

  • Error Message 8115 - NUMERIC to VARCHAR


    Arithmetic overflow error converting numeric to data type varchar.

  • Error Message 8133


    None of the result expressions in a CASE specification can be NULL.

  • Error Message 8134


    Divide by zero error encountered.

  • Error Message 8144


    Procedure Stored Procedure or Function Name, Line 0 Procedure or function Stored Procedure or Function Name has too many arguments specified.

  • Error Message 8147


    Could not create IDENTITY attribute on nullable column '<Column Name>', table '<Table Name>'.

  • Error Message 8152


    String or binary data would be truncated.

  • Error Message 8155


    No column name was specified for column <Column Index> of '<Object Name>'.

  • Error Message 8157


    All the queries in a query expression containing a UNION operator must have the same number of expressions in their select lists.

  • Error Message 8158


    '<Object Name>' has more columns than were specified in the column list.

  • Error Message 8159


    '<Object Name>' has fewer columns than were specified in the column list.

  • Error Message 8164


    An INSERT EXEC statement cannot be nested.

  • Error Message 10760


    Scale argument is not valid. Valid expressions for data type <Data Type> scale argument are integer constants and integer constant expressions.

  • Error Message 11700


    The increment for sequence object '<Sequence Name>' cannot be zero.

  • Error Message 11702


    The sequence object '<Sequence Name>' must be of data type int, bigint, smallint, tinyint, or decimal or numeric with a scale of 0, or any user-defined data type that is based on one of the above integer data types.

  • Error Message 11705


    The minimum value for sequence object '<Sequence Name>' must be less than its maximum value.

  • Error Message 11708


    An invalid value was specified for argument '<Argument Name>' for the given data type.

  • Error Message 11711


    Argument 'AS' cannot be used in an ALTER SEQUENCE statement.

  • Error Message 11719 - VIEW


    NEXT VALUE FOR function is not allowed in check constraints, default objects, computed columns, views, user-defined functions, user-defined aggregates, user-defined table types, sub-queries, common table expressions, or derived tables.

  • Error Message 11719 - USER-DEFINED FUNCTION


    NEXT VALUE FOR function is not allowed in check constraints, default objects, computed columns, views, user-defined functions, user-defined aggregates, user-defined table types, sub-queries, common table expressions, or derived tables.

  • Error Message 11721


    NEXT VALUE FOR function cannot be used directly in a statement that uses a DISTINCT, UNION, UNION ALL, EXCEPT or INTERSECT operator.

  • Error Message 11723


    NEXT VALUE FOR function cannot be used directly in a statement that contains an ORDER BY clause unless the OVER clause is specified.

  • Error Message 11741


    NEXT VALUE FOR function cannot be used within CASE, CHOOSE, COALESCE, IIF, ISNULL and NULLIF.