0

I need to find list of unique indices that does not have unique constraint on that column. How to achieve this?

I know, following query will give me unique constraints.

SELECT * 
FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS 
WHERE CONSTRAINT_TYPE='UNIQUE'

Note: I am using SQL Server 2012.

1

sys.indexes includes columns that identify if the index is unique, supports a unique constraint, or supports a primary key constraint. The query below lists unique indexes that do not support a constraint:

SELECT *
FROM sys.indexes
WHERE is_unique = 1 AND is_unique_constraint = 0 AND is_primary_key = 0;
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.