OOOPS.

Use the TOP syntax discussed last week, it is fast.

SELECT TOP 1 colname from tablename where ....order by colname desc

Dennis McGrath

________________________________
From: [email protected] [mailto:[email protected]] On Behalf Of 
[email protected]
Sent: Monday, May 10, 2010 10:52 AM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Re: Confirm Where count = INSERT


Thanks Bill and Dennis,



The COUNT = LAST gives an error -

-ERROR- Cannot use LAST with a server table. (2621)



I would run into problems with this anyway since this is in

a fairly heavy multi-user environment.



I issued the Select statement immediately after the INSERT and still did not get

the correct returned value, so I do not think the connection was closed.  I 
imagine

the syntax is not supported on an ODBC table like the above "LAST" clause,

but it just does not return an error.



I will use the MAX statement.  I was hoping to use the COUNT = INSERT  as it is 
almost

instantaneous and using the MAX and a where statement will be slower on this

large table.  I  imagine the speed will be acceptable though.



Thanks,

-Bob



----- Original Message -----
From: "Bill Downall" <[email protected]>
To: "RBASE-L Mailing List" <[email protected]>
Sent: Monday, May 10, 2010 10:07:26 AM GMT -06:00 US/Canada Central
Subject: [RBASE-L] - Re: Confirm Where count = INSERT

Bob,

It's possible that your ODBC connection was closed after the previous command, 
so that Oterro cannot really find the last row inserted by this particular 
connection.

Try COUNT = LAST (if another user's simultaneous hit of the same code is highly 
unlikely), or build a where clause that will find the row you want with no 
ambiguity.

Bill
On Mon, May 10, 2010 at 8:51 AM, 
<[email protected]<mailto:[email protected]>> wrote:

I have two RBASE databases -- Database "A" and "B".



I have one table in "B" that I need occasional access to from "A".

I have setup an ODBC connection between the two.



However, I need to use a command that I am not sure is supported

with the ODBC connection.



"where count = insert:"



The command does return a value and does not give any error,

but the value returned is not the inserted value. SkidData is the

RBASE ODBC table and has an autonum column "LabelNo".

R>insert into skiddata (PrimaryMO,ITEM,RecNotes ) values 'test','test','Testing 
ODBC'
 Successful INSERT operation, 1 rows generated.


R>sel labelno from skiddata where count = insert
 labelno
 ----------
        363

 The actual value inserted above was 412.   The returned value of 363 from
the "count = insert" statement is from the first row in the table.

I would like to confirm that the "count = insert" function is not supported on
ODBC tables and any ideas on how I might obtain the same functionality if it
is not supported.

Thanks,
-Bob


Reply via email to