---
title: "Error: ...Violation of PRIMARY KEY constraint 'ACTALT_PK'. Cannot insert duplicate key in object..."
canonical: "https://servicedesk.maxgeo.com/space/LC/1263894598/Error%3A%20...Violation%20of%20PRIMARY%20KEY%20constraint%20'ACTALT_PK'.%20Cannot%20insert%20duplicate%20key%20in%20object..."
format: markdown
---
<u>**Symptom:**</u>

This error is generated when trying to add a new Action Alert.

<u>**Troubleshooting:**</u>

To confirm the below **Cause **and **Solution **are correct, confirm that each time you attempt this update, the 'duplicate key value' stated at the end of the error message increases by one each time.

<u>**Cause:**</u>

Action Alerts were added, but not using the LeaseControl main application, and this adding of data was not conducted correctly.

*Technical details:* When inserting data into the [dbo].[LMS_ACTALT_ActionAlerts] table, the seed (which ordinarily increases incrementally) was not updated to show that bulk data was inserted - thus the main application is receiving incorrect information regarding the next valid PK, and thus using a PK already in existence.

<u>**Solution:**</u>

Run the ***below ***script on the affected LeaseControl database.

```sql
-- Client: MMG
-- Date: 16-SEP-2019
-- Author: clow(Maxwell)
-- Description: Fix for the incorrect id seed table. 
DECLARE @ID int
SELECT @ID = MAX(ACTALT_AlertID) FROM LMS_ACTALT_ActionAlerts
DBCC CHECKIDENT ('dbo.LMS_ACTALT_ActionAlerts', RESEED, @ID)
```

> ⚠️ DB Modification
> ⚠️ 
> ⚠️ Before any change is made to a user database (or system), maxgeo recommends competent staff should follow all standard database change management practices and never make untested changes to a production database.  
> ⚠️ Change, test and document all modifications on a test copy of your database to ensure results are as expected before implementing them on your live database. Always ensure a full backup is available in case rollback is required and follow all company change management procedures and practices.