Microsoft Dynamics GP[Microsoft][SQL Server Native Client 11.0]p[SQL Server]Violation of PRIMARY KEY constraint 'PKSY60100'. Cannot insert duplicate key in object 'dbo.SY60100'. The duplicate key value is (sa, 114).
The client clicked the OK button and GP Utilities ran through to completion. However, when the user logged into Microsoft Dynamics GP using the sa account, the company was not available for selection.
This is when they called us asking for help.
When we connected in we found that the company did have a record in Company Master (SY01500), but did not have an entry in User-Company Access (SY60100).
The company was listed in the Delete Company window (). However when the company was deleted, the database remained behind.
I’ve had problems deleting databases this way before, so when I was called over, I directed my colleague to delete the database directly in SQL Server Management Studio and run the Clear Companies script available in Microsoft KB 855361.
A quick search for the error message, revealed a Microsoft Knowledge Base article covering this exact issue.
At some point, the system database’s owner had been changed away from DYNSA. Running the following script set the owner back to DYNSA, allowing the company to be created: