Name 3 ways to get an accurate count of the number of records in a table?


Three different ways retrieve count number of records

SELECT * FROM table1 
SELECT COUNT(*) FROM table1 
SELECT rows FROM sysindexes WHERE id = OBJECT_ID(table1) AND indid < 2


Reference: www,timesjobs.com


Comments

Author: Fool To Code07 Jul 2010 Member Level: Gold   Points : 1

hey i have another one:
EXEC SP_SPACEUSED tablename.

find rows in result set.



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: