Here’s a T-SQL find tables without primary key.

The sys.indexes.is_primary_key column indicates whether a table has a primary key or not. The value 1 indicates that table has a primary key column and a value of 0 indicates that table doesn’t have a primary key column.  The output from above query is shown below.

1_T-SQL find tables without primary key



Ahmad Osama

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

Follow me on TwitterFollow me on FaceBook