Get the list of unique constraints and indexes in a database
Since unique constraints are implemented under the covers as indexes, you can get all of this information directly from sys.indexes:
SELECT
[schema] = OBJECT_SCHEMA_NAME([object_id]),
[table] = OBJECT_NAME([object_id]),
[index] = name,
is_unique_constraint,
is_unique,
is_primary_key
FROM sys.indexes
-- WHERE [object_id] = OBJECT_ID('dbo.tablename');
To repeat for all databases (and presumably without the filter for a specific table):
DECLARE @sql NVARCHAR(MAX) = N'';
SELECT @sql += 'SELECT db = ' + name + ',
[schema] = OBJECT_SCHEMA_NAME([object_id]),
[table] = OBJECT_NAME([object_id]),
[index] = name,
is_unique_constraint,
is_unique,
is_primary_key
FROM ' + QUOTENAME(name) + '.sys.indexes;'
FROM sys.databases
WHERE database_id BETWEEN 4 AND 32766;
EXEC sp_executesql @sql;
The other answers did not return complete lists for me. This query worked for me to return all unique indexes that are not primary keys or system tables:
select i.name as index_name, o.name as object_name
from sys.indexes i
join sys.objects o on i.object_id= o.object_id
where (i.is_unique_constraint = 1 OR i.is_unique = 1)
and i.is_primary_key = 0 and o.type_desc <> 'SYSTEM_TABLE'