Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 HOW TO FIND TOP 10 TABLES IN DATABAE?

Author  Topic 

sqlserverdbam
Yak Posting Veteran

54 Posts

Posted - 2008-10-29 : 10:39:38
Hi,

HOW TO FIND TOP 10 TABLES IN DATABAE?

Thanks,

-

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-10-29 : 10:45:02
Top 10 by rows?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2008-10-29 : 11:03:53
tables ?
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2008-10-29 : 11:19:02
What an easy question.

Please note that I am giving you *exactly* what you asked for. No more, no less

SELECT TOP 10 [table_name] FROM information_schema.tables


-------------
Charlie
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-10-29 : 11:43:19
at least specify whats the criteria for selecting top 10?
Go to Top of Page

mcrowley
Aged Yak Warrior

771 Posts

Posted - 2008-10-29 : 14:35:22
http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspx
Go to Top of Page

lionofdezert
Aged Yak Warrior

885 Posts

Posted - 2008-10-30 : 05:44:40
select top (10)
sch.name+'.'+tb.name,part.rows
from sys.partitions part inner join sys.tables tb
on part.object_id = tb.object_id INNER JOIN sys.schemas sch ON
sch.schema_id = tb.schema_id
ORDER BY part.rows desc
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-10-30 : 07:20:08
quote:
Originally posted by lionofdezert

select top (10)
sch.name+'.'+tb.name,part.rows
from sys.partitions part inner join sys.tables tb
on part.object_id = tb.object_id INNER JOIN sys.schemas sch ON
sch.schema_id = tb.schema_id
ORDER BY part.rows desc



Do you mean this according to rows:

select top 10.*
from(
select sch.name+'.'+ tb.name as [Tablename],max(part.rows)as rows
from sys.partitions part inner join sys.tables tb
on part.object_id = tb.object_id INNER JOIN sys.schemas sch ON
sch.schema_id = tb.schema_id
group by sch.name+'.'+ tb.name)t
ORDER BY rows desc
Go to Top of Page
   

- Advertisement -