Updating the Next Rec ID Sequence in Dynamics AX

by | Updated December 29, 2017 | Development, Dynamics AX

Recently I had to create database records outside of Dynamics AX. I used SQL to move some records from ISV tables to new standard tables within AX. There was a ton of data, so it was much faster to insert these records using SQL. Initially, I overlooked one important factor. When I created these records outside of the AX environment, the SystemSequences table was not updated.

The SystemSequences table stores the next RecID by table in the AX environment: https://msdn.microsoft.com/en-us/library/systemsequences.aspx
If this table is not updated properly, the users will see duplicate record errors that may not make sense to you. The users had sent me this error below. When I looked at the data, the Load ID did not exist. It didn’t throw an error about Rec IDs, so it’s a bit misleading.


The issue was that I had created records in the WHSLoadTable outside of AX.  The SystemSequences table wasn’t updated, so the next value of the Rec ID was incorrect and throwing an error. In this situation, you must update the SystemSequences table. You’ll need to find the max value for the table and update to the max value + 1.

Here is a portion of the SQL used to fix this issue:

I hope this helps you out!

Related Posts

  • Over on the AX Support site on MSDN, Daniel Durrer has taken the time to keep tabs on the latest builds for Microsoft Dynamics AX 4.0, 2009 and 2012.  I…

  • When the number sequence in Dynamics AX has reached the highest number, an error message will occur, “number sequence has been exceeded.” This can occur with any process done in…

  • Your Microsoft Dynamics AX system is a critical component of successfully managing your business. A Dynamics Health Check will proactively identify potential configuration and performance issues to maximize uptime and…


  1. Peter Petrillo

    Presume that 400 records need to be inserted to a table. The process would HAVE TO be inside of a cursor because I would have to update both myTable and SYSTEMSEQUENCES tables one record at a time.

    I dislike cursors. LOL! Is this assessment correct?

  2. Peter Petrillo

    How would you ensure concurrency problems did not occur when inserting records?

  3. Brandon Carmichael

    Hello Peter,

    Actually for your first question, you could insert your 400 records and then after you’ve inserted the records, update the one systemsequences table record that exists for the table you just inserted the records for. You will need to update the nextval to be the appropriate number, but only just the one time.

    In regards to your second question, you are going to want to make sure you are inserting unique records (paying attention to the primary key of the table). On the insert method, Nicole had a recID that ensured all of her records were unique. SQL should be able to handle all of that for you, but it’s safest to ensure you are using the primary index.

    Hope this helps, thank you.

Submit a Comment

Your email address will not be published. Required fields are marked *

Upcoming Events


12aug10:00 am10:30 amWhy Levridge Grain? How to Achieve Efficient and Accurate Scale Tickets

12aug12:00 pm1:00 pmThe Three Paths to Dynamics 365 Finance and Supply Chain from Dynamics AX

13aug11:00 am12:00 pmConfab with Stoneridge - Livestream - Inspire Keynote Breakdown

19aug10:00 am11:00 amWhat is Levridge? An Overview of the Ultimate Ag Solution

19aug12:00 pm12:30 pmThe Modern Manufacturer - Death by Safety Stock

27aug11:00 am12:00 pmConfab with Stoneridge - Livestream - Dynamics 365 2020 Wave 2 Preview


02sep10:00 am10:30 amThe Modern Manufacturer - Cycle Count Management

09sep10:00 am11:00 amWhat is Levridge? An Overview of the Ultimate Ag Solution

16sep10:00 am10:30 amThe Modern Manufacturer - Product Lifecycle Management

30sep10:00 am10:30 amThe Modern Manufacturer - Return Management

About Stoneridge
Stoneridge Software is a unique Microsoft Gold Partner, with emphasis on partner. With specialties in Microsoft Dynamics 365, Microsoft Dynamics AX, Microsoft Dynamics NAV, Microsoft Dynamics GP and Microsoft Dynamics CRM, we focus on attracting the most knowledgeable experts in the field to our team, and prioritize delivering stellar solutions with maximum impact for your business. At Stoneridge, we are deeply committed to your results. Each engagement is met with a dedicated team, ready to provide thorough, tailored, and expert service. Based in Minnesota, we intentionally “step into your shoes,” wherever you are. We focus on what you care about, and develop trusting, long-term relationships with our clients.

Subscribe To Our Blog

Sign up to get periodic updates on the latest posts.

Thank you for subscribing!