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.
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?MadhivananFailing to plan is Planning to fail |
 |
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2008-10-29 : 11:03:53
|
tables ? |
 |
|
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 lessSELECT TOP 10 [table_name] FROM information_schema.tables -------------Charlie |
 |
|
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? |
 |
|
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 |
 |
|
lionofdezert
Aged Yak Warrior
885 Posts |
Posted - 2008-10-30 : 05:44:40
|
select top (10)sch.name+'.'+tb.name,part.rowsfrom 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_idORDER BY part.rows desc |
 |
|
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.rowsfrom 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_idORDER 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 rowsfrom 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_idgroup by sch.name+'.'+ tb.name)tORDER BY rows desc |
 |
|
|
|
|