IDENT_SEED to Find the Seed?

  • Okay, this is confusing. When I do the following, I get a result of 1.

    SELECT IDENT_SEED('tablename')

    When I run this on the same table

    DBCC CHECKIDENT (tablename, NORESEED)

    I get the correct answer which is the following:

    "Checking identity information: current identity value '7290151', current column value '7290150'.

    DBCC execution completed. If DBCC printed error messages, contact your system administrator."

    Why doesn't the IDENT_SEED work for me? Can anyone see what I am doing wrong?

  • Well wasn't the original seed value 1?

    IDENT_SEED

    https://msdn.microsoft.com/en-CA/library/ms189834.aspx

    Returns the original seed value (returned as numeric(@@MAXPRECISION,0)) that was specified when an identity column in a table or a view was created.

    DBCC CHECKIDENT

    https://msdn.microsoft.com/en-us/library/ms176057.aspx

    Checks the current identity value for the specified table in SQL Server 2016 and, if it is needed, changes the identity value.


    SELECT quote FROM brain WHERE original = 1
    0 rows returned

  • It looks like you need

    SELECT IDENT_CURRENT('dbo.tablename')

    rather than IDENT_SEED.

    SQL DBA,SQL Server MVP(07, 08, 09) A socialist is someone who will give you the shirt off *someone else's* back.

  • yb751 (10/5/2015)


    Well wasn't the original seed value 1?

    IDENT_SEED

    https://msdn.microsoft.com/en-CA/library/ms189834.aspx

    Returns the original seed value (returned as numeric(@@MAXPRECISION,0)) that was specified when an identity column in a table or a view was created.

    DBCC CHECKIDENT

    https://msdn.microsoft.com/en-us/library/ms176057.aspx

    Checks the current identity value for the specified table in SQL Server 2016 and, if it is needed, changes the identity value.

    Oh jeez. I didn't get that. Thx.

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

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