Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Number Sequence continuous Script

Posted on by 3,252

Our client has over 150 Number Sequences that we need to change to Continous. Is there a way to execute a job or a sql query to update them all to non-continius? Knowing that all Number Sequence for one segment/company is required to be non-continous.

Thanks

*This post is locked for comments

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,280 Super User 2024 Season 2 on at
    RE: Number Sequence continuous Script

    Hi George,

    The job is not working indeed. You to change bit, but still it is not recommended and could cause performance issues:

    static void numberSequnceTable(Args _args)

    {

      NumberSequenceTable     numbersequenceTable;

      ;

      ttsBegin;

      while select forupdate numbersequenceTable where numbersequenceTable.Blocked == false

                                          && numbersequenceTable.Continuous == false

      {

          numbersequenceTable.Continuous = true;

          numbersequenceTable.update();

      }

      ttsCommit;

    }

  • Gilbert Khayat Profile Picture
    Gilbert Khayat 3,252 on at
    RE: Number Sequence continuous Script

    I am getting the following error

    Cannot edit a record in Number sequence (NumberSequenceTable).

    The operation cannot be completed, since the record was not selected for update. Remember TTSBEGIN/TTSCOMMIT as well as the FORUPDATE clause.

  • Suggested answer
    nunomaia Profile Picture
    nunomaia 10,684 Super User 2024 Season 1 on at
    RE: Number Sequence continuous Script

    Did you try to use the fill utility ?

    blogs.msdn.com/.../update-multiple-records-with-fill-utility.aspx

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,280 Super User 2024 Season 2 on at
    RE: Number Sequence continuous Script

    Hi George,

    I do agree with Klaas. We solved performance issues by unticking the continuous option. Please use it only for invoice numbers, vouchers and when it is another regulatory requirement.

  • Verified answer
    Klaas Deforche Profile Picture
    Klaas Deforche 2,431 on at
    RE: Number Sequence continuous Script

    Hi,

    Please also read the "Number sequence overview" page on MSDN if you haven't already: technet.microsoft.com/.../hh209457.aspx

    Continuous number sequences can adversely affect system response times because the system must request a number from the database every time that a new document or record is created.

    If you use a non-continuous number sequence, you can enable Preallocation on the Performance FastTab of the Number sequences form. When you specify a quantity of numbers to preallocate, the system selects those numbers and stores them in memory. New numbers are requested from the database only after the preallocated quantity has been used.

    Unless there is a regulatory requirement that you use continuous number sequences, we recommend that you use non-continuous number sequences for better performance.

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Number Sequence continuous Script

    I hope the below job will be change all number sequences from non- continuous to continuous to you..

    Job :

    static void numberSequnceTable(Args _args)

    {

       NumberSequenceTable     numbersequenceTable;

       ;

       while select numbersequenceTable where numbersequenceTable.Blocked == false

                                           && numbersequenceTable.Continuous == false

       {

           ttsBegin;

           numbersequenceTable.Continuous = true;

           numbersequenceTable.update();

           ttsCommit;

       }

    }

    If you have any queires please let me know  and If this is helpful to you please verify the same

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans