Wednesday 21 August 2024

Get the list of table which has identity column and seed values and last identity value in a database

Below script is used to get the list of table which has identity column and their seed values and last identity value.

SELECT Object_name(obj.object_id) AS table_name,

       ic.NAME                    AS column_name,

       is_identity,

       seed_value,

       increment_value,

       last_value

FROM   sys.identity_columns ic

       JOIN sys.objects obj

         ON obj.object_id = ic.object_id

WHERE  obj.type = 'U';

 


 

Popular Posts