Tuesday, 30 July 2013

Querty to Get Identity Tables information on SQL

Query to get Last Identity value inserted in tables in a database:

SELECT TableName = OBJECT_NAME(OBJECT_ID) ,
       ColumnName = name ,
       OriginalSeed = seed_value ,
       Step = increment_value ,
       LastValue = last_value ,
       IsNotForReplication = is_not_for_replication
FROM sys.identity_columns

No comments:

Post a Comment