You never have to count the table rows itself
But.... but... wouldn't this only be relevant if you just want the raw RecordCount?
As soon as you would do a COUNT FOR (or COUNT WHERE for you SQL guys) the metadata or systemtables don't help you a dime. And VFP's queryEngine is so intelligent that it can optimze a COUNT FOR by asking the indices, as long as the FOR condition is equal to an indexkey. BTW: since SQLServer got VFP's Rushmore logics, it should be the same there too.
wOOdy
-----Ursprüngliche Nachricht----- Von: ProFox profox-bounces@leafe.com Im Auftrag von Stephen Russell Gesendet: Montag, 26. Oktober 2020 02:01 An: ProFox Email List profox@leafe.com Betreff: Re: COUNT FOR hangs on record locking, but SQL - SELECT COUNT(*) works with no issue. Why?
The example was to do a count(*) in VFP. You don't have these system tables.
SELECT SCHEMA_NAME(schema_id) AS [SchemaName], [Tables].name AS [TableName], SUM([Partitions].[rows]) AS [TotalRowCount] FROM sys.tables AS [Tables] JOIN sys.partitions AS [Partitions] ON [Tables].[object_id] = [Partitions].[object_id] AND [Partitions].index_id IN ( 0, 1 ) -- WHERE [Tables].name = N'name of the table' GROUP BY SCHEMA_NAME(schema_id), [Tables].name;
You never have to count the table rows itself. I wasn't going to show this thinking that it wasn't viable in VFP.
those lawyers who are too stupid to see the obvious.