# MSSQL: "Cannot insert explicit value for identity column in table 'table' when IDENTITY\_INSERT is set to OFF" after adding an Identity column

**URL:** <https://forums.softvelocity.com/t/mssql-cannot-insert-explicit-value-for-identity-column-in-table-table-when-identity-insert-is-set-to-off-after-adding-an-identity-column/1052>\
**Category:** Knowledge Base\
**Tags:** unverified, database-drivers\
**Created:** [November 9, 2026, 1:41am UTC](https://forums.softvelocity.com/t/mssql-cannot-insert-explicit-value-for-identity-column-in-table-table-when-identity-insert-is-set-to-off-after-adding-an-identity-column/1052 "2026-11-09T01:41:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rzaunere](https://avatars.discourse-cdn.com/v4/letter/r/f14d63/32.png) [@rzaunere](https://forums.softvelocity.com/u/rzaunere)\
**Post date:** [November 9, 2026, 1:41am UTC](https://forums.softvelocity.com/t/mssql-cannot-insert-explicit-value-for-identity-column-in-table-table-when-identity-insert-is-set-to-off-after-adding-an-identity-column/1052/1 "2026-11-09T01:41:30Z")

</div>

**Applies to:** Clarion with the MSSQL driver and CapeSoft FM3, SQL Server, as reported in 2020.

**Problem**

A developer added a column meant to be an IDENTITY column through FM3's options. FM3 created the column without the Identity attribute. He then dropped and re-added it in T-SQL as `Int Identity(1, 1)`. From then on every insert from the application failed with `Cannot insert explicit value for identity column in table 'table' when IDENTITY_INSERT is set to OFF`.

**Solution**

1. An IDENTITY column is filled by the server. The application must not send a value for it; the error says the INSERT carried one.
2. In FM3's options the `IsIdentity` row must be followed by `ServerAutoIncColumn` with the dictionary column number of the identity column; an `AutoNumber` property in that place is not what FM3 expects. Fix that row so FM3 creates the column as an identity and the driver knows to leave it out of the INSERT.
3. If the insert still carries the value, mark the column READONLY in the dictionary: the External Name on the column's attributes tab, so the driver never writes it.
4. Reading the new identity value back into the record is a separate step; the Clarion help covers it under Server Autoinc.
5. For the poster the inserts started working after he ran a new FM3 conversion.

**Caveats**

- `SET IDENTITY_INSERT MyTable ON` before an INSERT (and OFF after) is for loading existing rows with their numbers; it is not the fix for ordinary inserts.
- For a plain sequential number that is not tied to one table, one poster pointed at SQL Server Sequences (2012 and later).
- The thread did not establish which of steps 2, 3 or 5 made the difference for the poster.

**Today (2026)**

Unchanged on the SQL Server side. The MSSQL driver's server auto-increment handling is documented in the help; the FM3 option names are CapeSoft's and may have moved in later FM3 versions. Not re-tested.

**Sources:** Antonio D. (Mar 2020, the question), Jon W., John S., Nick P. (Mar 2020) in softvelocity.clarion.databasedrivers.
