SQL Server Error Messages¶
-
ORDER BY items must appear in the select list if the statement contains a UNION operator.
-
The column prefix does not match with a table name or alias name used in the query.
-
The ORDER BY position number is out of range of the number of items in the select list.
-
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.
-
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.
-
'CREATE FUNCTION' must be the first statement in a query batch.
-
Missing end comment mark '*/'.
-
Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.
-
The object name 'Object Name' contains more than the maximum number of prefixes. The maximum is 2.
-
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'.
-
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.
-
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.
-
A TOP N value may not be negative.
-
The name
<Column Name>
is not permitted in this context.
Only constants, expressions, or variables allowed here. Column names are not permitted. -
Cannot perform an aggregate function on an expression containing an aggregate or a subquery.
-
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). -
A GOTO statement references the label '
-
The variable name
<Variable Name>
has already been declared. Variable names must be unique within a query batch or stored procedure. -
Cannot use a BREAK statement outside the scope of a WHILE statement.
-
Cannot use a CONTINUE statement outside the scope of a WHILE statement.
-
Must declare the scalar variable
<Variable Name>
. -
Cannot assign a default value to a local variable.
-
Can only use IF UPDATE within a CREATE TRIGGER statement.
-
A SELECT statement that assigns a value to a variable must not be combined with data-retrieval operations.
-
ORDER BY items must appear in the select list if SELECT DISTINCT is specified.
-
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.
-
Incorrect time syntax in time string
<Wait Time>
used with WAITFOR. -
a COMPUTE clause is not allowed in a SELECT INTO statement.
-
<Option>
is not a recognized DATEADD option. -
An aggregate may not appear in the set list of an UPDATE statement.
-
An aggregate may not appear in the OUTPUT clause.
-
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.
-
Procedure
<Rule Name>
, Line 1. Rule does not contain a variable. -
Procedure
<Rule Name>
, Line 1 Rule contains more than one variable. -
Each GROUP BY expression must contain at least one column that is not an outer reference.
-
'CREATE VIEW' does not allow specifying the database name as a prefix to the object name.
-
A column has been specified more than once in the order by list. Columns in the order by list must be unique.
-
The definition of column
<Column Name>
must include a data type. -
The dateadd function requires 3 argument(s).
-
The IDENTITY function can only be used when the SELECT statement has an INTO clause.
-
Cannot use the OUTPUT option in a DECLARE, CREATE AGGREGATE or CREATE FUNCTION statement.
-
The scale (
<Scale Value>
) for column<Column Name>
must be within the range 0 to<Precision Value>
. -
The scale must be less than or equal to the precision.
-
A SELECT INTO statement cannot contain a SELECT statement that assigns values to a variable.
-
Function Name is not a recognized function name.
-
SELECT INTO must be the first query in a statement containing a UNION, INTERSECT or EXCEPT operator.
-
EXECUTE cannot be used as a source when inserting into a table variable.
-
An INSERT statement cannot contain a SELECT statement that assigns values to a variable.
-
Procedure or function '
<Procedure Name>
' expects parameter '<Parameter Name>
', which was not supplied. -
All queries in an SQL statement containing a UNION operator must have an equal number of expressions in their target lists.
-
Ambiguous column name '
<Column Name>
'. -
Conversion failed when converting datetime from binary / varbinary string.
-
Insert Error: Column name or number of supplied values does not match table definition.
-
Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32).
-
There is insufficient result space to convert a money value to varchar / nvarchar / char / nchar.
-
Cannot convert a char value to money. The char value has incorrect syntax.
-
There is insufficient result space to convert a money value to varchar / nvarchar / char / nchar.
-
Types don't match between the anchor and the recursive part in column "
<Column Name>
" of recursive query "<Recursive Common-Table Expression Name>
". -
The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
-
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.
-
Syntax error converting the varchar value to a column of data type int.
-
The conversion of the varchar value overflowed an int column. Maximum integer value exceeded.
-
Recursive common table expression '
<CTE Name>
' does not contain a top-level UNION ALL operator. -
Recursive member of a common table expression '
<Common Table Expression>
' has multiple recursive references. -
The data type int is invalid for the substring function. Allowed types are: char/varchar, nchar/nvarchar, and binary/varbinary.
-
Must specify table to select from.
-
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. -
Cannot update a timestamp column.
-
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.
-
<Style number>
is not a valid style number when converting from datetime to a character string. -
There is insufficient result space to convert a smallmoney value to varchar/nvarchar.
-
Cannot convert a char value to smallmoney. The char value has incorrect syntax.
-
The conversion from char data type to smallmoney data type resulted in a smallmoney overflow error.
-
Conversion failed when converting character string to smalldatetime data type.
-
The conversion of char data type to smalldatetime data type resulted in an out-of-range smalldatetime value.
-
The conversion from datetime data type to smalldatetime data type resulted in a smalldatetime overflow error.
-
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.
-
The XML data type cannot be compared or sorted, except when using the IS NULL operator.
-
The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator.
-
The value
<MAXRECURSION Value>
specified for the MAXRECURSION option exceeds the allowed maximum of 32767. -
An insufficient number of arguments were supplied for the procedure or function Stored Procedure or Function Name.
-
Table-valued function '
<Function Name>
' cannot have a column alias. -
The target '
<Object Name>
' of the OUTPUT INTO clause cannot be a view or common table expression. -
The target table '
<Table Name>
' of the OUTPUT INTO clause cannot have any enabled triggers. -
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>
'. -
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>
'. -
The target table '
<Table Name>
' of the DML statement cannot have any enabled triggers if the statement contains an OUTPUT clause without INTO clause. -
DEFAULT or NULL are not allowed as explicit identity values.
-
The parameter "
<Parameter Name>
" can not be declared READONLY since it is not a table-valued parameter. -
The table-valued parameter
must be declared with the READONLY option. -
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. -
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>
'. -
Invalid operator for data type. Operator equals add, type equals text.
-
The text, ntext, and image data types cannot be used in an ORDER BY clause.
-
The text/ntext/image data type cannot be selected as DISTINCT because it is not comparable.
-
Invalid use of 'getdate' within a function.
-
Invalid use of 'INSERT' within a function.
-
Invalid use of 'UPDATE' within a function.
-
Select statements included within a function cannot return data to a client.
-
The last statement included within a function must be a return statement.
-
DISTINCT operator is not allowed in the recursive part of a recursive common table expression '
<Common Table Expression Name>
'. -
DISTINCT operator is not allowed in the recursive part of a recursive common table expression '
<Common Table Expression Name>
'. -
Outer join is not allowed in the recursive part of a recursive common table expression '
<Common Table Expression Name>
'. -
GROUP BY, HAVING, or aggregate functions are not allowed in the recursive part of a recursive common table expression '
<CTE Name>
'. -
The synonym "
<Synonym Name>
" referenced synonym "<Synonym Name>
". Synonym chaining is not allowed. -
Invalid PERCENT tablesample size "
<sample_number>
" for table "<Table Name>
". The PERCENT tablesample size must be between 0 and 100. -
Invalid ROWS value or REPEATABLE seed in the TABLESAMPLE clause for table "
<Table Name>
". The value or seed must be an integer. -
The TABLESAMPLE clause cannot be used in a view definition or inline table function definition.
-
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. -
The OUTPUT clause cannot be used in an INSERT...EXEC statement.
-
The TABLESAMPLE clause can only be used with local tables.
-
Variables are not allowed in the TABLESAMPLE or REPEATABLE clauses.
-
Cannot insert the value NULL into column 'Column Name', table 'Table Name'; column does not allow nulls. INSERT fails.
-
Invalid length parameter passed to the substring function.
-
Invalid length parameter passed to the LEFT or SUBSTRING function.
-
Cannot insert explicit value for identity column in table
Table Name
when IDENTITY_INSERT is set to OFF. -
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'.
-
INSERT statement conflicted with COLUMN FOREIGN KEY constraint Constraint Name. The conflict occurred in database Database Name, table Table Name, column Column Name.
-
DELETE statement conflicted with COLUMN REFERENCE constraint Constraint Name. The conflict occurred in database Database Name, table Table Name, column Column Name.
-
UPDATE statement conflicted with COLUMN REFERENCE constraint Foreign Key Constraint Name. The conflict occurred in database Database Name, table Table Name, column Column Name.
-
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.
-
The objects "Object Name" and "Object Name" in the FROM clause have the same exposed names. Use correlation names to distinguish them.
-
Syntax '*' is not allowed in schema-bound objects.
-
The TOP N WITH TIES clause is not allowed without a corresponding ORDER BY clause.
-
INSERT into an identity column not allowed on table variables.
-
Column 'Table.Primary Key' is not the same length as referencing column 'Referencing Table.Referencing Column' in foreign key 'Foreign Key Constraint Name'.
-
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'
-
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'.
-
Column already has a DEFAULT bound to it.
-
Cannot create more than one clustered index on table 'Table Name'. Drop the existing clustered index 'Clustered Index Name' before creating another.
-
Cannot create index on view '
<View Name>
' because the view is not schema bound. -
Cannot create index on view '
'. It does not have a unique clustered index. -
Cannot insert duplicate key row in object '
<Object Name>
' with unique index '<Index Name>
'. -
Violation of PRIMARY KEY constraint Constraint Name. Cannot insert duplicate key in object Table Name.
-
The text, ntext, and image data types are invalid for local variables.
-
The text, ntext, and image data types are invalid for local variables.
-
The multi-part identifier could not be bound.
-
View or function 'View or Function Name' has more column names specified than columns defined.
-
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. -
Create View or Function failed because no column name was specified for column
<Column Number>
. -
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. -
CREATE FUNCTION failed because a column name is not specified for column
<Column Number>
. -
Cannot truncate table '
<Table Name>
' because it is being referenced by a FOREIGN KEY constraint. -
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. -
Cannot alter column
<Column Name>
because it is COMPUTED. -
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.
-
Objects exposing columns with CLR types are not allowed in distributed queries. Please use a pass-through query to access remote object '
<Object Name>
'. -
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.
-
Cannot update identity column 'Column Name'.
-
Table '
<Table Name>
' does not have the identity property. Cannot perform SET operation. -
IDENTITY_INSERT is already ON for table Table Name. Cannot perform SET operation for table Table Name.
-
Cannot add identity column, using the SELECT INTO statement, to table '
<Table Name>
', which already has column '<Column Name>
' that inherits the identity property. -
Cannot add multiple PRIMARY constraints to table '
<Table Name>
'. -
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.
-
None of the result expressions in a CASE specification can be NULL.
-
Divide by zero error encountered.
-
Procedure Stored Procedure or Function Name, Line 0 Procedure or function Stored Procedure or Function Name has too many arguments specified.
-
Could not create IDENTITY attribute on nullable column '
<Column Name>
', table '<Table Name>
'. -
String or binary data would be truncated.
-
No column name was specified for column
<Column Index>
of '<Object Name>
'. -
All the queries in a query expression containing a UNION operator must have the same number of expressions in their select lists.
-
'
<Object Name>
' has more columns than were specified in the column list. -
'
<Object Name>
' has fewer columns than were specified in the column list. -
An INSERT EXEC statement cannot be nested.
-
Scale argument is not valid. Valid expressions for data type
<Data Type>
scale argument are integer constants and integer constant expressions. -
The increment for sequence object '
<Sequence Name>
' cannot be zero. -
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. -
The minimum value for sequence object '
<Sequence Name>
' must be less than its maximum value. -
An invalid value was specified for argument '
<Argument Name>
' for the given data type. -
Argument 'AS' cannot be used in an ALTER SEQUENCE statement.
-
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.
-
NEXT VALUE FOR function cannot be used directly in a statement that uses a DISTINCT, UNION, UNION ALL, EXCEPT or INTERSECT operator.
-
NEXT VALUE FOR function cannot be used directly in a statement that contains an ORDER BY clause unless the OVER clause is specified.
-
NEXT VALUE FOR function cannot be used within CASE, CHOOSE, COALESCE, IIF, ISNULL and NULLIF.