IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[V_UNIQUE_INDEXES]'))
DROP VIEW [dbo].[V_UNIQUE_INDEXES]
GO


create view V_UNIQUE_INDEXES as select tab.name as TableName, si.name as IndexName, sc.name as ColumnName
from sysindexes si, sysindexkeys sik, syscolumns sc, sysobjects tab 
where si.indid > 0 and sik.indid = si.indid and sik.id = si.id 
and si.id = tab.id and sc.id = tab.id and sik.colid = sc.colid 
and tab.type = 'U' and indexproperty(si.id, si.name, 'IsUnique') = 1
and not exists(select * from sysobjects pk where pk.xtype='PK' and pk.name = si.name)
and not exists(select * from sysobjects pk, sysconstraints sck, sysindexkeys sckc
where pk.xtype='PK' and pk.parent_obj = tab.id and pk.id = sck.constid 
and sckc.colid = sck.colid and sckc.indid = si.indid and sckc.id = si.id)