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 |
lkiran086
Starting Member
21 Posts |
Posted - 2014-06-19 : 08:01:34
|
HiHow Can I Get the Count of Records of each table in data base? |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2014-06-19 : 08:12:27
|
[code]SELECT object_name(object_id),SUM (row_count) FROM sys.dm_db_partition_stats where (index_id=0 or index_id=1)group by object_name(object_id) order by 1[/code] |
|
|
djj55
Constraint Violating Yak Guru
352 Posts |
Posted - 2014-06-19 : 08:44:05
|
[code]SELECT t.NAME AS TableName, p.rows AS RowCounts FROM sys.tables t INNER JOIN sys.indexes i ON t.OBJECT_ID = i.object_id INNER JOIN sys.partitions p ON i.object_id = p.OBJECT_ID AND i.index_id = p.index_id WHERE t.NAME NOT LIKE 'dt%' AND t.is_ms_shipped = 0 AND i.OBJECT_ID > 255 GROUP BY t.Name, p.Rows ORDER BY TableName[/code]djj |
|
|
adsingh82
Starting Member
20 Posts |
Posted - 2014-06-20 : 07:49:00
|
Please refer this below url to see for other possible techniques to count the rows in each and every table.[url]http://dotnetbites.com/rows-count-tables-sql-database[/url]Regards,Alwyn.M |
|
|
|
|
|