जगदीश खोलिया: Count total rows in a table

Friday, May 4, 2012

Count total rows in a table

Number of ways to count rows in a table :  

*) select count(*) from LifeEmailQuotesXML

*) select count(1) from LifeEmailQuotesXML
 
*) select sum(1) from LifeEmailQuotesXML

*) select object_name(id), rows from sys.sysindexes where object_name(id) = 'LifeEmailQuotesXML' and indid < 2

*) exec sp_spaceused 'LifeEmailQuotesXML'

*) DBCC CHECKTABLE('LifeEmailQuotesXML')

*) DBCC UPDATEUSAGE ('BimaExpress','LifeEmailQuotesXML') WITH COUNT_ROWS

No comments: