TSQL Script to fetch the list of tables with identity properties

Posted on : 09-08-2015 | By : Devi Prasad | In : Identity

0

Below is the TSQL Script to fetch the list of tables in a database with identity column properties

SELECT SCHEMA_NAME(T.SCHEMA_ID) AS SCHEMA_NAME,
       OBJECT_NAME(T.OBJECT_ID) AS TABLENAME,
       TI.NAME AS COLUMN_NAME,
       TI.SEED_VALUE,
       TI.INCREMENT_VALUE,
       TI.LAST_VALUE AS LAST_VALUE
FROM   SYS.TABLES AS T
       INNER JOIN
       SYS.IDENTITY_COLUMNS AS TI
       ON T.OBJECT_ID = TI.OBJECT_ID