In this blog we’ll see T-SQL query to find tables with identity columns In SQL Server.  It can be done in two ways either by using Information_schema catalog or the system catalog views.

A T-SQL to find table with identity columns using Information_Schema is given below.

The output from above query is given below.

1_Find tables with identity columns in SQL Server

A T-SQL to find all tables with identity columns using sys catalog views is given below.

2_Find tables with identity columns in SQL Server

A key point to note is to include Schema name along with table name when passing values to function IDENT_SEED, IDENT_INCR and IDENT_CURRENT otherwise you the functions may return null values even if a table has an identity column.



Ahmad Osama

Like us on FaceBook Join the fastest growing SQL Server group on FaceBook

Follow me on TwitterFollow me on FaceBook