Technical Article

Get List of tables with no identity columns

,

Run the script to get list of tables in DB without an identity field.

SELECT TABLE_NAME
FROM   INFORMATION_SCHEMA.TABLES
WHERE  Table_NAME NOT IN (SELECT c.TABLE_NAME
                          FROM   INFORMATION_SCHEMA.COLUMNS c
                                 INNER JOIN sys.identity_columns ic
                                         ON ( c.COLUMN_NAME = ic.NAME ))
       AND TABLE_TYPE = 'BASE TABLE';

Rate

3 (4)

You rated this post out of 5. Change rating

Share

Share

Rate

3 (4)

You rated this post out of 5. Change rating