Ways of Retrieving Table Row Count without using Count function.

vishalneeraj-24503
Posted by vishalneeraj-24503 under Sql Server category on | Points: 40 | Views : 244
2 ways to achieve this:-
1ST WAY:-
select convert(bigint,rows) as Row_Count
from sysindexes
where id = object_id('Test1')
and indid < 2;

2ND WAY:-
select sum(row_count) as Row_Count 
from sys.dm_db_partition_stats
WHERE object_id = OBJECT_ID('Test1')
AND (index_id in(0,1));

Comments or Responses

Login to post response