| How to
find unique indexes in a database? |
|
The following
query will list unique indexes which are not primary keys:
use DatabaseX
select IndexName=Name, [Table] = object_name(id)
from sysindexes where status & 2 = 2
and ID not in (select parent_obj from sysobjects where xtype='PK')
and ID in (select id from sysobjects where xtype='U')
|
| The Best SQL Server
Training in the World |
|