How to fix the .Net error: Cannot insert explicit value for identity column in table when IDENTITY_INSERT is set to OFF

Jump to: navigation, search

When attempting to save changes to a table the following exception is thrown. Cannot insert explicit value for identity column in table when IDENTITY_INSERT is set to OFF Unfortunately, I had to drop the table and then add it again with the following constraints. I suspect what I was missing was the FILLFACTOR property which has to do with page splits. Perhaps if you can add this property to an existing table you will not need to drop and add. CONSTRAINT [PK_tbMyTableName] PRIMARY KEY CLUSTERED ( [ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY] ) ON [PRIMARY]

See also

Personal tools
Namespaces
Variants
Views
Actions
Navigation