|
Try this:
select c.name as ColumnName
, o.name as TableName
, count(cc.name) as NumCols
from
sysobjects o
join syscolumns c
on c.id = o.id
and o.xtype = 'U'
left join syscolumns cc
on c.name = cc.name
join sysobjects co
on cc.id = co.id
and co.xtype = 'U'
group by c.name, o.name
order by NumCols desc, ColumnName, TableName
ignore all of the columns that have NumCols = 1
__________________
Silver '88 RoW Carrera
Grey '06 A4 Avant
|