Tuesday, April 6, 2010

Deadlocks with number sequences

Number sequence cannot be set up and used in the same transaction. If you’ll try to do so you’ll face a deadlock. This happens because of the fact that AX uses separate connection to get next number from a number sequence.

For example, the following code will cause deadlock:
public static void testNumberSequences()
    NumberSequenceTable numberSequenceTable;
    NumberSequenceReference numberSequenceReference;

    numberSequenceTable.NumberSequence = 'A';
    numberSequenceTable.Lowest = 1;
    numberSequenceTable.Highest = 99999;
    numberSequenceTable.NextRec = 1;
    numberSequenceTable.Format = '#####';
    numberSequenceTable.Continuous = NoYes::No;

    numberSequenceReference.DataTypeId = typeId2ExtendedTypeId(typeid(ItemGroupId));
    numberSequenceReference.NumberSequence = numberSequenceTable.NumberSequence;


By moving the line with num() call out of tts scope the deadlock will be eliminated.


  1. Hello, There's no doubt that your web site may be having browser compatibility problems. Whenever I look at your web site in Safari, it looks fine however, if opening in IE, it has some overlapping issues. I merely wanted to give you a quick heads up! Apart from that, great site!

    My site - Corporate Movers
    My web page: Ohio Moving

  2. I enjoy what you guys are up too. Such clever work and reporting!
    Keep up the fantastic works guys I've added you guys to my blogroll.

    My page ... Movers Dayton

  3. Wonderful, what a webpage it is! This webpage provides valuable information to us, keep it up.

    Also visit my web site: Storage Dayton

  4. Aw, this was an incredibly nice post. Finding the time and actual
    effort to create a really good article… but what can I say…
    I put things off a whole lot and don't manage to get nearly anything done.

    green coffee extract reviews (greencoffeebeanmaxs.org)

  5. Valuable information. Lucky me I discovered your web site by chance, and
    I am surprised why this accident did not came about earlier!
    I bookmarked it.

    Rvtl Anti Aging Solutions

  6. Your style is really unique compared to other folks I've read stuff from. Thanks for posting when you have the opportunity, Guess I will just bookmark this page.

    Lipo slender review

  7. Hello are using Wordpress for your blog platform? I'm new to the blog world but I'm trying
    to get started and create my own. Do you need any coding expertise to make your own blog?
    Any help would be really appreciated!

    Buy mito slim

  8. Very good blog! Do you have any tips for aspiring writers?
    I'm hoping to start my own blog soon but I'm a little lost on
    everything. Would you propose starting with a free platform like Wordpress or go
    for a paid option? There are so many options out there that I'm completely overwhelmed .. Any suggestions? Thanks!

    My page Lean Muscle FOrmula Price

  9. It's very straightforward to find out any topic on net as compared to textbooks, as I found this paragraph at this web site.

    sex drive

  10. Did you know that you can make cash by locking special sections of your blog / site?
    All you need to do is to open an account on Ad Work Media and add their Content Locking widget.