-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
- -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
- - -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Be careful with doing a select MAX(col) from table, if you're under
load you might not get the right ID.
The way I like to do it, and that works with any DB out there is to
create a table with an ID and just select the ID from that table first
and update it, THEN do all the inserts I need to do. You can have a
table with one ID for the whole thing, or one ID per table (the way I
like to do it):
create table uniqueIDTable(
theID int not null)
or
create table uniqueIDTable(
theID int not null,
theName varchar(100) not null)
do the select form the ID, and update it by increasing it by one.
If you were using Java, I would show you a way to do the select MAX(id)
from table method, and assure that it will work all the time... you
can't do it with Tango because there is no way to do synchronization
like you can in Java. Of course if you want to use a java bean for
that, I would be more than glad to send you the code.
R
On Tuesday, August 27, 2002, at 06:48 PM, Thomas Ferguson wrote:
> nevermind... since it was an autonum, I just retreived the last row
> and
> extracted the key.
>
> Any idea on how to do this without an autonum and no date/time stamp?
>
> Just curious.
>
> TIA
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Thomas Ferguson
> Sent: Tuesday, August 27, 2002 6:06 PM
> To: Multiple recipients of list witango-talk
> Subject: Witango-Talk: Key of Record Just Written
>
>
> I know I've seen this before, but I can't find it in the archives...
>
> How do I get the value of the key of the record I just wrote? I'm
> using MS
> SQL with the key defined as an AutoNum (Identity).
>
> Thanks in advance
>
> Top Ferguson
> ARiSAR, Inc.
>
> 727.577.7474 - Office
> 727.577.7494 - Fax
> 727.510-9863 - Mobile
>
> www.arisar.com
>
> _______________________________________________________________________
> _
> TO UNSUBSCRIBE: send a plain text/US ASCII email to
> [EMAIL PROTECTED]
> with unsubscribe witango-talk in the message body
>
> _______________________________________________________________________
> _
> TO UNSUBSCRIBE: send a plain text/US ASCII email to
> [EMAIL PROTECTED]
> with unsubscribe witango-talk in the message body
>
Robert S. Sfeir
Senior Java Engineer
PGP Key available at: pgpkeys.mit.edu
KeyID: 128C88C7
- - -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (Darwin)
iD8DBQE9bASnAP6i6RKMiMcRAgCrAJ9koWuGEz08lxR1wrlGXQ/nwvPIrgCgioe6
u3J/qkF3EBTpAPC5gBc7Dqw=
=X1XT
- - -----END PGP SIGNATURE-----
- -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (Darwin)
iD8DBQE9bAULAP6i6RKMiMcRAjBVAJ91jErc77TbmJaBI2Lud/3O7zLKtACdHtT+
hZPT5bd/r7QCQOnkeXuSk+w=
=YETT
- -----END PGP SIGNATURE-----
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (Darwin)
iD8DBQE9bAUzAP6i6RKMiMcRAgLnAKCrVjhP8Gb6lYl1UYf22olbIH0BcACg+fni
JgBzJPOO/hrdrxOC0tUMeNQ=
=RhVi
-----END PGP SIGNATURE-----
________________________________________________________________________
TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED]
with unsubscribe witango-talk in the message body