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 |
wkm1925
Posting Yak Master
207 Posts |
Posted - 2011-01-31 : 01:56:27
|
Hi,I've database named ST3DB. In ST3DB, having a tables as following1. t12. t23. t34. t95. t23I need to count many record on each table. As a result, the output as followingTables | Record No------------------------t1 | 34t2 | 78t3 | 77t9 | 84t23 | 278How my sql looks like? |
|
sathishmangunuri
Starting Member
32 Posts |
Posted - 2011-01-31 : 02:08:01
|
Hi,try this! select o.name,s.row_count from sys.objects o join sys.dm_db_partition_stats s on o.object_id=s.object_id AND o.is_ms_shipped = 0sathish |
 |
|
Ranjit.ileni
Posting Yak Master
183 Posts |
Posted - 2011-01-31 : 03:58:46
|
also--Count Records in All TablesSELECT sysobjects.Name , sysindexes.RowsFROM sysobjects INNER JOIN sysindexes ON sysobjects.id = sysindexes.idWHERE type = 'U' AND sysindexes.IndId < 2IRK |
 |
|
wkm1925
Posting Yak Master
207 Posts |
Posted - 2011-02-01 : 20:38:01
|
tq sir |
 |
|
Ranjit.ileni
Posting Yak Master
183 Posts |
Posted - 2011-02-01 : 23:41:44
|
welcomeIRK |
 |
|
eralper
Yak Posting Veteran
66 Posts |
Posted - 2011-02-03 : 09:24:08
|
sys.partitions system view can also be used to list all tables in a sql database with row counts. Here is an example [url]http://www.kodyaz.com/articles/sql-rowcount-using-sql-server-system-view-sys-partitions.aspx[/url]-------------Eralperhttp://www.kodyaz.com |
 |
|
|
|
|