Updating Range - ID constraint broken on insert

  • We're finding that when we are doing a lot of individual inserts that the process sometimes errors when it rolls over into the next range.  This is not bulk updating and so it's not an insufficient threshold problem.  The error relates to the id being out of range. (Cant' remember the exact message).  I suspect what's happening is that the next identity is updated before the constraint and the whole process isn't wrapped in a transaction (I suspect or why would it be possible for another record to be added in between each step).  Generally the next record will work OK - though sometimes it doesn't because we have a transaction wrapped around multiple inserts - in that case we usually have to manually update the constraint to reflect the new range in msrepl_identity_range.

    Is this what's happening here?  If not does anyone know what?  And is there a way around it?

     

    cheers,

    michael

  • Dragging this one up the list again.  Hopefully someone new will have an idea what's going on.

    cheers,

    Michael

  • Please explain what you mean by "when it rolls over into the next range".  Also, it's been 2 months and you still haven't posted the exact error message.  Might also want to identify if the ID is an IDENTITY column or not.  Posting some DDL for the problematic table and perhaps the DML for the offending code would help as well.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply