On Tue, Nov 15, 2016 at 9:10 AM, Gianluca Rigotti <[email protected]>
wrote:
> Hi all,
> I try to locate a record using a SQL query knowing only the record number.
> Reading SQL manual I know about the virtual field that contain the record
> ID (that is the record number). So I wrote something like this:
>
> Begin SQL
> select field123
> from table1
> where __ROW_ID = 10
> into :$myVar
> End SQL
>
> and works. The problem is that the virtual “ __ROW_ID” field seems to be
> mantained as "no indexed” field, and the query is sequential and really
> slow for very large tables.
> So my question is: there is a way to fast locate a record using the record
> number into a SQL query?
>
I would assume not as I do not think record number is indexed so selecting
by it using sql would be sequential
You could also try a fn call in sql. I would not recommend this however
this is one of those cases where you are better off using 4D so it would
look like this
goto record([table1];10)
this is instantaneous
Regards
Chuck
--
-----------------------------------------------------------------------------------------
Chuck Miller Voice: (617) 739-0306 Fax: (617) 232-1064
Informed Solutions, Inc.
Brookline, MA 02446 USA Registered 4D Developer
Providers of 4D, Sybase & SQL Sever connectivity
http://www.informed-solutions.com
-----------------------------------------------------------------------------------------
This message and any attached documents contain information which may be
confidential, subject to privilege or exempt from disclosure under
applicable law. These materials are intended only for the use of the
intended recipient. If you are not the intended recipient of this
transmission, you are hereby notified that any distribution, disclosure,
printing, copying, storage, modification or the taking of any action in
reliance upon this transmission is strictly prohibited. Delivery of this
message to any person other than the intended recipient shall not
compromise or waive such confidentiality, privilege or exemption
from disclosure as to this communication.
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ: http://lists.4d.com/faqnug.html
Archive: http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:[email protected]
**********************************************************************