Violation of Primary Key Constrain

Top  Previous  Next

When you uncheck the "Audit file autonumbering" option to activate SQL server-side autonumbering of the audit file, and you forget to define the ID field as identity, you will get the following error (or something alike) as soon as you generate the second entry in the audit file:

 

 

clip0075

 

This is because being both auto-numbering methods disabled, the audit trail will be saved with an ID number of zero; thus on the second save it will be zero again, therefore, a duplicate entry.