select so.name as TableName, sind.name as PKName,
case
when (sind.status & 0x800) = 0x800 then 'PK'
else 'IX'
end as IndexType,
sik.keyno, col.name as ColName ,
case
when sind.indid = 1 then 'Yes'
else ''
end as 'Clustered Indexes'
from sysobjects so
inner join sysindexes sind on so.id=sind.id
inner join sysindexkeys sik on sind.id=sik.id and sind.indid=sik.indid
inner join syscolumns col on col.id=sik.id and col.colid=sik.colid
where so.xtype = 'U'
and sind.root <> 0x0 -- this should eliminate stats
order by so.name, sik.keyno
PS:MUST HAVE DATA IN YOUR DATABASE TABLES.
case
when (sind.status & 0x800) = 0x800 then 'PK'
else 'IX'
end as IndexType,
sik.keyno, col.name as ColName ,
case
when sind.indid = 1 then 'Yes'
else ''
end as 'Clustered Indexes'
from sysobjects so
inner join sysindexes sind on so.id=sind.id
inner join sysindexkeys sik on sind.id=sik.id and sind.indid=sik.indid
inner join syscolumns col on col.id=sik.id and col.colid=sik.colid
where so.xtype = 'U'
and sind.root <> 0x0 -- this should eliminate stats
order by so.name, sik.keyno
PS:MUST HAVE DATA IN YOUR DATABASE TABLES.