Saturday, July 4, 2009

Retrieve number of records from the table

There are many methods available to retrieve the number of records from the table.

Some of them are:



1.

SELECT COUNT(*)
FROM MyTable



2.

SELECT rows
FROM sysindexes
WHERE id = OBJECT_ID(MyTable)
AND indid < 2




Both the above methods will return the number of records in the Sql Server table.

No comments:

Post a Comment