[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: SQL Q
Aaron Turner wrote:
>
> What is the standard way of inserting a row and then determining the
> autogenerated UniqueID for that row?
If your keys are numeric and are being generated sequentially, find the
largest key (which should be the most recent if numeric). Next do an
insert and search for any records having a table key greater than that.
Since most of my keys are not sequential (mumble micros~1 mumble access
mumble) I get around it in one of two ways:
Every time I add a record, I have a time stamp field which contains the
add date and time. I can search on that when I have to look for recent
recoreds.
Failing that, I have several boolean fields which indicate whether or
not that particular set of data had been treated under a given analysis;
new data defaults to false for all of these flags. This way, I don't
have to reanalyse everything every time I add data to the table. So, if
you can have a catch-all field (I like boolean, tho I don't know if your
db will do that) in your particular table, just set all of the records
to true BEFORE you add the new records; your recently added data will
all have the field set to false.
Hope this helps. This worked for me, but chances are that Jason would
have a far better idea of how to do this (and I would love to know what
he would do).
Pete
--
Pete St. Onge
pete@seul.org
- References:
- SQL Q
- From: Aaron Turner <aturner@linuxkb.org>