sql server - SQL query to retrieve all table's un-unique identifiers (indexes) -
is there way count every table in database, number of unique , number of un-unique identifiers (indexes)
i using sql server 2012 database
select object_name(object_id), sum(case when type = 1 1 else 0 end) 'primary_count', sum(case when type = 2 1 else 0 end) 'unique_count' sys.indexes m group object_id,is_unique_constraint
sys.indexes contain column type if 1 means unique , if 2 means non unique constraint , if 0 means heap particular object_id.
Comments
Post a Comment