Select By and @RECCOUNT (OpenInsight 32-Bit)
At 17 MAR 2008 08:50:30PM Don Muskopf wrote:
It seems that if you use the Select…By statement and specify null for the sort criteria that @RECCOUNT always returns zero, assuming @RECCOUNT has been initialized to zero before the Select…By statement executes.
Shouldn't @RECCOUNT be set correctly regardless of whether you sort or not?
At 17 MAR 2008 11:10PM Warren Auyong wrote:
@RECCOUNT only gets set if the SELECT is fully resolved. If I recall correctly SELECT BY doesn't get resolved until the first READNEXT operation. It might depend on the size of the file too.
REDUCE or RLIST should fully resolve the SELECT.
At 18 MAR 2008 10:52AM Don Muskopf wrote:
If you don't sort, @RECCOUNT is still zero even after the first readnext.
The documentation states "The Select…By statement results in a resolved cursor." Indeed, you do get the expected SELECT results even when the sort parameter is null. But @RECCOUNT is zero.
The documentation for @RECCOUNT states, "If there is an active, resolved select list, this variable contains the number of keys in the list."
This implies to me that @RECCOUNT is not being updated and it should be. Am I off base here?
At 18 MAR 2008 11:14AM Warren Auyong wrote:
If you don't sort the READNEXT just reads sequentially through the groups without scanning the entire file first.
At 18 MAR 2008 11:29AM Don Muskopf wrote:
Thanks Warren. Makes sense now.
At 18 MAR 2008 05:46PM Richard Hunt wrote:
Given that info… would this item relate? Has to do with selects and sizelock!