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
 General SQL Server Forums
 New to SQL Server Programming
 Count(*)

Author  Topic 

sanjay5219
Posting Yak Master

240 Posts

Posted - 2012-10-02 : 06:40:28
Hi All,

Is there any way where i can find the rows in all the tables.

Please suggest

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-10-02 : 06:47:30
[code]SELECT
OBJECT_NAME(OBJECT_ID) TableName,
row_count
FROM
sys.dm_db_partition_stats
WHERE
index_id < 2[/code]
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-10-02 : 10:31:12
quote:
Originally posted by sanjay5219

Hi All,

Is there any way where i can find the rows in all the tables.

Please suggest


do you mean row count or rows present in all tables based on a value?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2012-10-05 : 04:55:24
quote:
Originally posted by visakh16

quote:
Originally posted by sanjay5219

Hi All,

Is there any way where i can find the rows in all the tables.

Please suggest


do you mean row count or rows present in all tables based on a value?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/




Most likely row count as the title says

Other methods http://beyondrelational.com/modules/2/blogs/70/posts/10817/different-ways-to-count-rows-from-a-table.aspx

Madhivanan

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

mani_1234
Starting Member

24 Posts

Posted - 2012-10-05 : 05:50:12

select a.name , b.rows from sys.tables a
inner join sys.partitions b
on a.object_id = b.object_id
order by b.rows desc
Go to Top of Page

johncooper565
Starting Member

1 Post

Posted - 2012-10-05 : 05:54:27
Is there any way where i can find the rows in all the tables.

unspammed


Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-10-06 : 00:31:31
quote:
Originally posted by johncooper565

Is there any way where i can find the rows in all the tables.

unspammed





did you try any of suggestion above?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -