Few days ago I got a case with one of my clients complaining that he's getting the following error when trying to save new Analytical Accounting Transaction Dimension :
[Microsoft][SQL Native Client][SQL Server] Violation of PRIMARY KEY constraint 'PK_AAG00600'. Cannot insert duplicate key in object 'dbo.AAG00600'.
While investigating the issue I found that the table "Dynamics.AAG00102" that holds the next values for Tree's has incorrect index, so I just pulled the maximum ID in AAG00600 table, and then went to Dynamics.AAG00102 located "600" under aaTableID and changed the aaRowID to the maximum number + 1 of the values in AAG00600.
If you don't link to modify this manually, this was already solved in KB under the following link, there is a script file that will reset all counters for Analytical Accounting and fix this issue out: