Script to get tables which have primary key

,

There isn't a convenient sp or tool in sql server to find out all the tables in a database which have primary keys. This script can help you to list all the tables with primary keys.

select object_name(id)  from sysindexes
where (status&2048)<>0
order by object_name(id)

Rate

Share

Share

Rate