Contents tagged with Cannot insert explicit value for identity column in table when identity_insert is set to off
today I received the following error message in Acumatica:
Cannot insert explicit value for identity column in table when identity_insert is set to off.
After executing SQL
SET IDENTITY_INSERT table off
problem wasn't solved, so I needed to search deeper. After attaching with SQL Profiler, I noticed that Acumatica generated SQL, which tried to insert null into key field. Then was time to look in manual.
And then I noticed that for key fields statement IsKey = true is not used. Instead is used
So I replaced [PXDBInt(IsKey = true)] with [PXDBIdentity] and problem disappeared. more