>> 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-boun...@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.


_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: https://leafe.com/archives
This message: 
https://leafe.com/archives/byMID/057001d6ab6e$c1d803c0$45880b40$@wondzinski.de
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to