Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread DBISAM -> EDB: LASTAUTOINC
Thu, Mar 12 2009 1:55 PMPermanent Link

Michael Fullerton
I have a DBISAM project I want to port to EDB. Problem is the coder
used several calls to LASTAUTOINC to get the last ID field in a table.
I'm not sure how to do something similar in EDB. The help mentions
FETCH but it doesn't work for me.

Can some explain how to convert these statements in to EDB
equivalents:

select LASTAUTOINC("MyTable") from MyTable

insert into RTable (ID, RDate) VALUES (LASTAUTOINC("MyTable "),
:RDate)

FETCH LAST from MyTable (ID) gives an error:

ElevateDB Error #700 An error was found in the statement at line 1 and
column 1 (Expected INSERT, UPDATE, DELETE, CREATE, ALTER, DROP, GRANT,
REVOKE, BACKUP, RESTORE, REPAIR, OPTIMIZE, IMPORT, EXPORT, DISCONNECT,
REMOVE but instead found begin)

Thanks in advance
Thu, Mar 12 2009 2:38 PMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Michael


Does MAX(columnname) work for you?

Roy Lambert
Thu, Mar 12 2009 3:02 PMPermanent Link

Michael Fullerton
On Thu, 12 Mar 2009 18:38:11 +0000, Roy Lambert
<roy.lambert@skynet.co.uk> wrote:

>Does MAX(columnname) work for you?

It does indeed. Thanks Roy.
Thu, Mar 12 2009 7:02 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Michael,

<< Can some explain how to convert these statements in to EDB equivalents:

select LASTAUTOINC("MyTable") from MyTable

insert into RTable (ID, RDate) VALUES (LASTAUTOINC("MyTable "), :RDate) >>

If you simply want to get the last identity value for an inserted row, then
the easiest way to do this is with a paramterized INSERT statement:

http://www.elevatesoft.com/newsgrp?action=openmsg&group=17&msg=2164&page=1#msg2164

--
Tim Young
Elevate Software
www.elevatesoft.com

Image