"Violation of PRIMARY KEY constraint" Error message when you try to do the year-end closing routine in General Ledger in Microsoft Dynamics GP
This article provides a solution to an error that occurs when you try to do the year-end closing routine in General Ledger in Microsoft Dynamics GP.
Applies to: Microsoft Dynamics GP
Original KB number: 856553
Symptoms
When you try to do the year-end closing routine in General Ledger in Microsoft Dynamics GP, you receive the following error message:
[Microsoft][ODBC SQL Server Driver][SQL Server]Violation of PRIMARY KEY constraint 'PKGL10110'. Cannot insert duplicate key in object 'GL10110'.
Resolution
To resolve this problem, use the steps below:
Have all users exit Microsoft Dynamics GP.
Restore a backup of the company database that was made before you tried to do the General Ledger year-end closing routine.
Start SQL Server Management Studio. To do it, select Start, point to All Programs, point to Microsoft SQL Server 20XX (XX=your version), and then select SQL Server Management Studio.
Run the following scripts against the company database to delete the GL Account Summary tables:
DELETE GL10110 DELETE GL10111
Run Check Links on the Financial Series. To do it:
- On the Microsoft Dynamics GP menu, point to Maintenance, and then select Check Links.
- In the Series list, select Financial, and then select All to insert all the Logical Tables to the Selected Tables list.
- Select OK.
Run reconcile for all the years in the Year list to rebuild the summary tables. To do it,
- On the Microsoft Dynamics GP menu, point to Tools, point to Utilities, point to Financial, and then select Reconcile.
Note
Select the Year check box and then select the year.
- Select the Year check box.
- Select the History option, and then select the oldest year in the Year list.
- Select Reconcile.
- Repeat steps c and d for each year that is listed in the Year list. Start with the oldest year, and end with the current year.
- On the Microsoft Dynamics GP menu, point to Tools, point to Utilities, point to Financial, and then select Reconcile.
Do the year-end closing routine in General Ledger.
More information
For more information, see KB -Year-end closing procedures for General Ledger in Microsoft Dynamics GP.
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for