IDENTITY_INSERT

  • Comments posted to this topic are about the item IDENTITY_INSERT

    God is real, unless declared integer.

  • Nice question to start the week thanks Thomas.

    ...

  • Nice tricky one to start the week on, thanks Thomas

    ____________________________________________
    Space, the final frontier? not any more...
    All limits henceforth are self-imposed.
    “libera tute vulgaris ex”

  • Yes, tricky one.
    Couldn't find this properly explained (set identity_insert) so went for 3/4.

  • paul s-306273 - Monday, February 11, 2019 1:47 AM

    Yes, tricky one.
    Couldn't find this properly explained (set identity_insert) so went for 3/4.

    ..., but thinking about it, the next insert after i = 104 would give you a duplicate!

  • A good question.

    In the explanation:

    So although we deleted the row with i = 104 (while IDENTITY_INSERT is still ON) it does not reuse this value nor does it use / fill the gap between 3 and 102.


    Note that whether IDENTITY_INSERT is turned OFF either before or after the row is deleted, the result is the same.  It doesn't reuse the value.

  • nice and simple,
    was looking for the trick/gotcha but couldn't find one,
    thanks for the questions

    ---------------------------------------------------------------------------------------
    The more you know, the more you know that you dont know

  • Thanks for this instructive question. 

    - webrunner

    -------------------
    A SQL query walks into a bar and sees two tables. He walks up to them and asks, "Can I join you?"
    Ref.: http://tkyte.blogspot.com/2009/02/sql-joke.html

Viewing 8 posts - 1 through 7 (of 7 total)

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