Hi,
Is there any other ways to get row count in a table without using this SQL
statement : SELECT Count(*) FROM Table_Name ?
Thanks!
Vincent
Printable View
Hi,
Is there any other ways to get row count in a table without using this SQL
statement : SELECT Count(*) FROM Table_Name ?
Thanks!
Vincent
sorry no way..look for easy ways in life!!!
"Vincent" <vinc_ngd@hotmail.com> wrote:
>
>Hi,
>
>Is there any other ways to get row count in a table without using this SQL
>statement : SELECT Count(*) FROM Table_Name ?
>
>Thanks!
>Vincent
If you are going to use this table in a recordset anyway you could get it
through the count property. Of course for the count to be accurate here
it needs to be a disconnected recordset or else you must move it to the last
record first.
The select count(*) should be a fast query though.
"Vincent" <vinc_ngd@hotmail.com> wrote:
>
>Hi,
>
>Is there any other ways to get row count in a table without using this SQL
>statement : SELECT Count(*) FROM Table_Name ?
>
>Thanks!
>Vincent
"davinci" <spruett@lifeway.com> wrote:
>
>If you are going to use this table in a recordset anyway you could get it
>through the count property. Of course for the count to be accurate here
>it needs to be a disconnected recordset or else you must move it to the
last
>record first.
>
>The select count(*) should be a fast query though.
>
>"Vincent" <vinc_ngd@hotmail.com> wrote:
>>
>>Hi,
>>
>>Is there any other ways to get row count in a table without using this
SQL
>>statement : SELECT Count(*) FROM Table_Name ?
>>
>>Thanks!
>>Vincent
>
Hello
This works for Microsoft SQL Server. This assumes that you have a primary
key for the table you want to know the total rows.
Try the following query on Northwind database.
SELECT si.rowcnt FROM sysindexes si INNER JOIN sysobjects so ON si.id = so.id
WHERE si.rowcnt > 0 AND si.indid = 1 AND so.name = 'Order Details'
go
SELECT Count(*) FROM [Order Details]
Both queries yield same result. Still the latter is simpler than the former.
Don't let it bother you, the performance of Count(*) function is as much
optimized as possible by all RDBMS products.
Narayana