On Transact SQL language the Msg 544 Level 16 - Cannot insert explicit value for identity column in table means that the IDENTITY_INSERT is set to OFF.
Msg 544 Level 16 Example:
We have the table teachers:
USE model;
GO
CREATE TABLE teachers(
ID INT IDENTITY NOT NULL PRIMARY KEY,
Name VARCHAR(250) NOT NULL,
Department VARCHAR(250) NOT NULL);
GO
Invalid insert:
USE model;
GO
INSERT INTO teachers(id, name, department)
VALUES (1, 'Olivia Wilson', 'Anthropology'), (2,'Ethan Davis', 'Biology');
GO
Message |
---|
Msg 544, Level 16, State 1, Line 1 |
Cannot insert explicit value for identity column in table 'teachers' when IDENTITY_INSERT is set to OFF. |
Correct insert:
USE model;
GO
INSERT INTO teachers(name, department)
VALUES ('Olivia Wilson', 'Anthropology'), ('Ethan Davis', 'Biology');
GO
Message |
---|
(2 row(s) affected) |
Other error messages:
- Conversion failed when converting date and/or time from character string
- Is not a defined system type
- Conversion failed when converting the varchar value
- Unknown object type used in a CREATE, DROP, or ALTER statement
- Cannot insert the value NULL into column
- The INSERT statement conflicted with the FOREIGN KEY constraint
- The DELETE statement conflicted with the REFERENCE constraint