Top 10 largest tables in a database by rowcount:
Top 10 largest tables in a database by allocated space:
Top 10 largest tables in a database by used allocated space:
select top 10 name, row_count(db_id(), id) from sysobjects order by row_count(db_id(),id) desc
Top 10 largest tables in a database by allocated space:
select top 10 name, reserved_pages(db_id(),id) /(1024.0 / (@@maxpagesize/1024.0) ) as "Allocated MB" from sysobjects order by reserved_pages(db_id(),id) desc go
Top 10 largest tables in a database by used allocated space:
select top 10 name, used_pages(db_id(),id) /(1024.0 / (@@maxpagesize/1024.0) ) as "Used MB" from sysobjects order by used_pages(db_id(),id)(db_id(),id) desc go**These are not my own queries..Credit goes to Bret Halford on sybase forums.
Top 10 largest tables in a database by rowcount:
Top 10 largest tables in a database by allocated space:
Top 10 largest tables in a database by used allocated space:
select top 10 name, row_count(db_id(), id) from sysobjects order by row_count(db_id(),id) desc
Top 10 largest tables in a database by allocated space:
select top 10 name, reserved_pages(db_id(),id) /(1024.0 / (@@maxpagesize/1024.0) ) as "Allocated MB" from sysobjects order by reserved_pages(db_id(),id) desc go
Top 10 largest tables in a database by used allocated space:
select top 10 name, used_pages(db_id(),id) /(1024.0 / (@@maxpagesize/1024.0) ) as "Used MB" from sysobjects order by used_pages(db_id(),id)(db_id(),id) desc go**These are not my own queries..Credit goes to Bret Halford on sybase forums.
2 comments:
Hi ! Many thanks !
There's an error on the last part ( Top 10 largest tables in a database by used allocated space: ):
used_pages(db_id(),id)(db_id(),id) desc
must be
used_pages(db_id(),id) desc
He has copied it twice in the order by clause. remove one of them and it will work.
Post a Comment