Hi!
Because despite the "TOP 1" ODER BY in the query cause getting the entire table for sorting. THis is slow approach, indeed. There are other approaches. One of them is to use the table that store last ID for each table (described in many places, you can read about it in the FAQ article at the
www.tek-tips.com site, VFP forum).
>I made a free table with two columns iValue and iDel (both integers). There are 500,000 rows in the table. With the following ASP I get a value the way I want it. However, it is much slower than having 50,000 rows in the table. Why? I have simple indexes on both columns.
>
>
>Response.Buffer = True
>Response.ContentType = "text/xml"
>Set oConn = Server.CreateObject("ADODB.Connection")
>With oConn
> .ConnectionString = "Provider=VFPOLEDB.1;Data Source=E:\localweb;Deleted=Off;Password=;Collating Sequence=MACHINE"
> .CursorLocation = 2 ' adUseServer
> .Mode = 16 ' adModeShareDenyNone
> .Open
>End With
>Application.Lock
>arResult = oConn.Execute("Select iValue from UniqInt02 Where iDel=0 Order by iValue Top 1").GetRows
>oConn.Execute("Update UniqInt01 Set iDel=1 Where iValue=" & arResult(0,0) )
>Application.Unlock
>Response.Write "<?xml version="&Chr(34)&"1.0"&Chr(34)&"?><ROOT><response><ivalue> " & arResult(0,0) & "</ivalue></response></ROOT>" ' There is an XML string there you just can't see it on the UT
>Set oConn = Nothing
>
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.comICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs
It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.