Aggro <sp**********@yahoo.com> wrote in message news:<jb***************@read3.inet.fi>...
Bart Van der Donck wrote:
My problem in this scenario:
I want to read out this number 6 before I will insert that record. Is
that possible?
May I ask why? I can't imagine any good reason for that.
I am working with binary objects that I store in a directory. I let
the application take the ID of a row, then put a file extension behind
this ID, and finally put a fixed directory path before the ID. That
way the application knows which object belongs to which row in my
table.
Now when adding new records, I have to know though what the name of
the object must be. Obviously the same as the ID of my row that I am
about to insert. So that the application can find it back later.
So basically I was hoping for something like:
"SELECT CURRENT_AUTO_INCREMENT_NUMBER FROM mytable"
or even better, something like:
"INSERT INTO mytable VALUES ('','data1','data2') RETURN
AUTO_INCREMENT"
and that it would return the value that was inserted in the first
field (that was an AUTO_INCREMENT)
regards
Bart