I don't know much other than postgres, but if the ID you want is from a serial field (serial is like an auto-number, or auto-increment in other DB's), you can find out the ID's BEFORE you insert the data, and then insert the data with the IDs handed to you.
Basically, postgres stores it's sequences for the serial fields in a seperate entity. Thus if you have a table MyFriends with data:
Id | name
------------
1 joe
2 bob
3 sue
You can SELECT nextval('myfriends_id_seq'); and it will return 4. Now, the next person who does an insert (normal insert, with nextval, or otherwise) will get 5.... so 4 is yours to use! Then instead of just INSERT INTO MyFriends(name) VALUES ('frank'); you would use the ID handed to you ... INSERT INTO MyFriends(ID, name) VALUES (4, 'frank');
You can grab a swath of id's this way before-hand, if you have multiple lines to edit.
I don't know if any of this applies to anything but postgres, but maybe it's food for thought

(Maybe you can find a way to do something like this in your DB.)
Otherwise, yeah, you'll have to resort to something a little less elegant like a timestamp or magic-number field.