‘%.*ls’ does not contain an identity column.

Error Message:
Msg 7997, Level 16, State 1, Line 1
‘%.*ls’ does not contain an identity column.

Severity level:
16.

Description:
This error message appears when you try to execute the DBCC CHECKIDENT command on a table that has no column with the IDENTITY property.

Consequences:
The T-SQL statement can be parsed, but causes the error at runtime.

Resolution:
Errors of the Severity Level 16 are generated by the user and can be fixed by the SQL Server user. The statement cannot be executed this way. You can execute DBCC CHECKIDENT only on those tables that have a column with the IDENTITY property.

Versions:
All versions of SQL Server.

Example(s):
USE tempdb;
GO
IF OBJECT_ID(‘tempdb..t’) > 0
 DROP TABLE t
GO
CREATE TABLE t
(
 id INT
)
GO
DBCC CHECKIDENT(‘t’)

Remarks:
In the above example we try to use DBCC CHECKIDENT on the table t. Because there is no column with the IDENTITY property in this table, the error is raised.




Array

No comments yet... Be the first to leave a reply!