-2

Cannot insert explicit value for identity column in table 'Tbl_UserGroup' when IDENTITY_INSERT is set to OFF.

I got the error message: Cannot insert explicit while saving, but using sql command line the value got inserted, the problem just is using the form. What is the possible solution?

Vojtěch Dohnal
  • 7,154
  • 2
  • 36
  • 91
  • 1
    possible duplicate of [Cannot insert explicit value for identity column in table 'table' when IDENTITY\_INSERT is set to OFF](http://stackoverflow.com/questions/1334012/cannot-insert-explicit-value-for-identity-column-in-table-table-when-identity) – Kyle Hale Nov 24 '14 at 17:29

1 Answers1

2

You need to set identity insert ON if you are going to explicitly insert values into identity column

SET IDENTITY_INSERT table  ON 

--Insert statement 

SET IDENTITY_INSERT table  OFF
Pரதீப்
  • 85,687
  • 16
  • 112
  • 148