giovedì 24 aprile 2014

Query per trovare tabelle e righe totali in un db


Con questa query possiamo trovare tutte le tabelle con il numero di righe ordinate per tabella con più dati

select so.name as NomeTabella,max(si.rows) as righe from sysobjects as so
inner join sysindexes as si
on si.id=so.id and so.xtype='U'
group by so.name
order by 2 desc;

Nessun commento:

Posta un commento