-3

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,867
  • 3
  • 43
  • 105
  • 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ரதீப்
  • 91,748
  • 19
  • 131
  • 172