I might be wrong, as I don't have much experience in this field. But what I sometimes did when trying to find the ID of the row I just inserted is to query the database for exactly the same information that was entered right after inserting it. This will only work if all columns together qualify as a key (aka, no two rows are exactly the same minus the ID field). It's quick and dirty. _____ From: gameprogrammer-bounce@xxxxxxxxxxxxx [mailto:gameprogrammer-bounce@xxxxxxxxxxxxx] On Behalf Of Laurence Grant Sent: Monday, October 30, 2006 9:56 PM To: gameprogrammer@xxxxxxxxxxxxx Subject: [gameprogrammer] Re: Slightly offtopic: SQL Command You need to look at the sqlca structure after the insert. It's a standard ANSII structure, but depending on the language you're using, there will be different ways to access it. It I recall, sqlca.sqlerrd[2] or maybe [1], but then again, it depends on if your language treats arrays relative to 0 or 1, but that struct should have the serial id after an insert. Check the docs, or google it, but you should find something on it. _____ From: gameprogrammer-bounce@xxxxxxxxxxxxx [mailto:gameprogrammer-bounce@xxxxxxxxxxxxx] On Behalf Of Alan Wolfe Sent: Monday, October 30, 2006 10:23 PM To: gameprogrammer@xxxxxxxxxxxxx Subject: [gameprogrammer] Re: Slightly offtopic: SQL Command if you know that the maximum id is 8 before going in and then afterwords its 11, how do you know which ID number is the one that YOU were assigned? The answer is you can't so unfortunately that wont work ): On 10/30/06, Mikael Eriksson <mikael_miffe_eriksson@xxxxxxxx> wrote: On Tue, Oct 31, 2006 at 02:24:46PM +1300, Jake Briggs wrote: > Which database? Serial is a sqlserver thing isn't it? You can't reliably > do this sort of thing on sql server 2003 (I think that's the right > version). My solution was convoluted and annoying, involving a dummy > table to simulate a sequence (like a sequence from postgres) and making > sure to keep the transaction atomic. Could't you get the ids before and after the insert, and do somekind of diff? --------------------- To unsubscribe go to http://gameprogrammer.com/mailinglist.html