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) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • 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