Find Increment Values and Current Identity value of all tables in a database


Use DatabaseName
Go
SELECT IDENT_SEED(TABLE_NAME) AS SeedValue,
IDENT_INCR(TABLE_NAME) AS IncrementValue,
IDENT_CURRENT(TABLE_NAME) AS Current_Identity_Value,
TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE OBJECTPROPERTY(OBJECT_ID(TABLE_NAME), ‘TableHasIdentity’) = 1
AND TABLE_TYPE = ‘BASE TABLE’

Advertisements

Tagged: ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: