Skip to main content

View all UNIQUE constraints on a database

To view all unique constraints in a database in MSSQL, use below auery.
select TC.Constraint_Name, CC.Column_Name, CC.TABLE_NAME from information_schema.table_constraints TC inner join information_schema.constraint_column_usage CC on TC.Constraint_Name = CC.Constraint_Name where TC.constraint_type = 'Unique'
order by TC.Constraint_Name;

Comments

Popular posts from this blog

Get all constraints in Oracle

 To get all the constraints created in Oracle database, use below query.              SELECT * FROM USER_CONSTRAINTS; If you want to get the constraints  created for a particular user then use below SQL query.              SELECT   *   FROM  USER_CONSTRAINTS where owner = 'userName';