Cannot insert explicit value for identity column in table when IDENTITY_INSERT is OFF.

KameAn's profile image KameAn posted 1 month ago in General Permalink

From Revision 12.8.0.6957, 22 nov 2024 Inserting a new row from data tab into a table with identity column returns error even if the IDENTITY_INSERT property is already on.

ansgar's profile image ansgar posted 1 month ago Permalink

Please post the error message you mean.

KameAn's profile image KameAn posted 1 month ago Permalink

"SQL Error (544): Cannot insert explicit value for identity column in table 'TableName' when IDENTITY_INSERT is set to OFF."

I've tried on multiple tables with identity column, with SQL Server Management Studio, and with older versions of HeidiSQL without any problems

ansgar's profile image ansgar posted 1 month ago Permalink

You say the IDENTITY_INSERT property is already on, but the message clearly says the opposite.

https://stackoverflow.com/questions/1334012/cannot-insert-explicit-value-for-identity-column-in-table-table-when-identity

KameAn's profile image KameAn posted 1 month ago Permalink

I apologize, my English lacks, I wrote something wrong I'll try to explain myself better by giving an example

Actually, from "Data" tab of a table, if I use "Insert Row" and leave NULL as the value is ok, a new row is created and identity column is automatically populated ( value is visible after refresh ).

But if I choose "Duplicate row with keys" or "Duplicate row without keys" fails, whether I delete the contents of the field or not

Previously, I could do this by clearing the contents of the field before confirming the row, while now it seems that Heidi tries to assign the field empty ( not NULL ) and this fails because IDENTITY_INSERT is set to OFF ( correctly )

Please login to leave a reply, or register at first.