Done testing identity 2

  • Comments posted to this topic are about the item Done testing identity 2

  • Good question, thanks Steve.

    ...

  • Yeah, thought 0,0 or 0,1 and assumed it must be the latter.
    Oops.

  • Weird thing:
    DBCC CHECKIDENT('dbo.SalesOrderHeader', RESEED, 0)

    Returns this message:

    Checking identity information: current identity value 'NULL'.
    DBCC execution completed. If DBCC printed error messages, contact your system administrator.


    So, the SELECT IDENT_CURRENT('dbo.SalesOrderHeader')
    returns 0 instead of NULL,  The INSERT uses 0.
    Now, SELECT IDENT_CURRENT('dbo.SalesOrderHeader') returns 0.

  • Nice question, thanks Steve...
    i liked the wrong options, gives a real twist....

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

  • As documented in a number of places, the explanation "When all rows are removed from the table, the SEED is used for the identity value." is not entirely accurate.  DELETE FROM MyTable has different behavior from TRUNCATE TABLE My Table.

Viewing 6 posts - 1 through 5 (of 5 total)

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