Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

Cannot Insert Duplicate key row activating AA

(0) ShareShare
ReportReport
Posted on by

Hi,

When I try to activate Analytical Accounting, I receive the error "Cannot insert duplicate key row in object AAG40000' with unique index 'AK2AAG40000'. 

How can I fix this ?

 

 

*This post is locked for comments

  • Community Member Profile Picture
    on at
    RE: Cannot Insert Duplicate key row activating AA

    Hi Cory,

    I had the same problem where there actually were duplicate entries in the GL30000 for some old history years so I deleted the history for those years and AA activated after that.  If you can find the duplicates and they are for years that you do not need to access then maybe you could do that also. If not then  I agree that I can't think of any repercussions of moving the GL30000 table before activating AA and then moving it back.

    Tracy

  • Cory Severson Profile Picture
    695 on at
    RE: Cannot Insert Duplicate key row activating AA

    Hey Tracy,

    I gave this a shot and I didn't have any data in my AAG tables when I first try the activation.  I tried it again and it still broke.  I believe mine occurs because it actually does see duplicates in history.

    I don't need historical AA data anyway so do you think it would be fine to move the GL30000 to a backup table, run the AA activation, and then move the GL30000 data back?  I tried this process and AA activates fine.  I'm wondering if there may be any repercussions in the future but I can't think of any.

    Thanks!

    Cory

  • Community Member Profile Picture
    on at
    RE: Cannot Insert Duplicate key row activating AA

    Hi Cory,

    I opened a support case on this issue and below was the response :

    The main reason why we get this error is if there are any records existing in the AAG tables prior to activation. Try the resolution given below and try reactivating AA. if you still receive the error message, please let me know your availability so we can stream in to take a first hand look at the issue.

    Before each new attempt to activate AA, delete scripts must be run to clear out the AA tables before the activation process can be started again. To do this, follow these steps:

    1. Update the status of AA to '1' (1=installed, but not activated) to start the activation process over. Run this script against the Dynamics database:

    Update AAG00104 set aaCompanyStatus = '1' where CMPANYID = 'xx'

    (Insert the value of the Company ID from the SY01500 table for the xx placeholder.)

    2. Execute these scripts in to clear out all the AA data tables. Run these scripts all at the same time against the company database:

    Delete AAG10000

    Delete AAG10001

    Delete AAG10002

    Delete AAG10003

    Delete AAG20000

    Delete AAG20001

    Delete AAG20002

    Delete AAG20003

    Delete AAG30000

    Delete AAG30001

    Delete AAG30002

    Delete AAG30003

    Delete AAG40000

    Delete AAG40001

    Delete AAG40002

    Delete AAG40003

    Delete DYNAMICS..SY00800 where BCHSOURC = 'aaWizardInstall'

    3. Start the activation process over again.

    Hope this helps.

  • Community Member Profile Picture
    on at
    RE: Cannot Insert Duplicate key row activating AA

    Hello Tracy,

    Did you ever hear anything on this post?  I'm getting the same error.  

    Msg 2601, Level 14, State 1, Procedure aagTODglHist, Line 1

    Cannot insert duplicate key row in object 'dbo.AAG40000' with unique index 'AK2AAG40000'. The duplicate key value is (44644, 0.00000, 2008, GLTRX00007406).

    The statement has been terminated.

    I ran a trace and it appears to occur when the aagTODglHist stored procedure is being run.

    Thanks,

    Cory

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >

Featured topics

Product updates

Dynamics 365 release plans