count - SQL query to retrieve number of keys in database -


how can retrieve total number of primary keys, , secondary keys, unique indexes table in database? there function in sql allow me this?

i using sql server 2012 database

this query against sys.indexes system catalog view might give need (or @ least it's starting point):

select      indexname = i.name,     tablename = object_name(i.object_id),     i.index_id,     i.type_desc,     i.is_unique,     i.is_primary_key,     i.is_unique_constraint sys.indexes 

it lists indexes tables in current database, , show index name, table name, index type (clustered or non-clustered), , flags primary key, unique index etc.

you can read lot more sql server catalog views , information might have on msdn!


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -