SQL SERVER – Find Current Identity of Table

Many times we need to know what is the current identity of the column. I have found one of my developer using aggregated function MAX() to find the current identity.

USE AdventureWorks
GO
SELECT MAX(AddressID)
FROM Person.Address
GO

SQL SERVER - Find Current Identity of Table identity1

However, I prefer following DBCC command to figure out current identity.

USE AdventureWorks
GO
DBCC CHECKIDENT ('Person.Address')
GO

SQL SERVER - Find Current Identity of Table identity2

Reference : Pinal Dave (https://darkslategrey-bat-805937.hostingersite.com)

SQL Index, SQL Scripts, SQL Server DBCC
Previous Post
SQLAuthority News – Famous Quotes From Bill Gates
Next Post
SQLAuthority News – White Paper: Security Overview for Database Administrators

Related Posts

Leave a Reply