Ok, this is dumb. How do I get the total number of records in an SQL table.
I know I've done this before, but the mind is mush.
Thanks.
> Ok, this is dumb. How do I get the total number of records in an SQL
> table.
Use a COUNT aggregate:
SELECT COUNT(*) FROM dbo.MyTable;
You also have the option in SQL 2005 to get an approximate count using the
catalog views (e.g. sys.partitions). This can be much faster than counting
the individual rows.

Signature
Hope this helps.
Dan Guzman
SQL Server MVP
http://weblogs.sqlteam.com/dang/
> Ok, this is dumb. How do I get the total number of records in an SQL
> table.
>
> I know I've done this before, but the mind is mush.
>
> Thanks.
Lost Soul - 12 Mar 2008 00:52 GMT
Thanks Dan, I got it, I must have posted just after you.
Cheers and thanks.
>> Ok, this is dumb. How do I get the total number of records in an SQL
>> table.
[quoted text clipped - 13 lines]
>>
>> Thanks.
Never mind all, I figured it out - stupid me.
SELECT count(COLUMN) FROM dbo.TABLEname
Sorry folks.
> Ok, this is dumb. How do I get the total number of records in an SQL
> table.
>
> I know I've done this before, but the mind is mush.
>
> Thanks.