Look into the mysql_insert_id function, that looks like what you want.
On Feb 24, 2004, at 12:02 PM, David Scott wrote:
Hi list peeps
In many of my projects I have the need to insert a new record into a
table and then later on in the script update this record, Right now I
am doing this by
Hi list peeps
In many of my projects I have the need to insert a new record into a table and then
later on in the script update this record, Right now I am doing this by doing the
insert, then immediately doing a Select to return the latest id (unique id) which I
store later for my update.
At 17:02 + 2/24/04, David Scott wrote:
Hi list peeps
In many of my projects I have the need to insert a new record into a
table and then later on in the script update this record, Right now
I am doing this by doing the insert, then immediately doing a Select
to return the latest id
You could try creating a function in Java or C/C++ or whatever your
preference is that wraps the select statements up for you and returns the
insert ID.
Original Message
On 2/24/04, 11:02:51 AM, David Scott [EMAIL PROTECTED] wrote regarding
INSERT returning ID:
Hi list peeps
In many
but there are ways to get this value. The Java API handles this case
just fine, and I'd be willing to bet other API's do it as well.
here's some simple code to do with the Java API:
String sql = some insert sql statement;
Statement stmt = getConnection().createStatement();
At 10:25 -0700 2/24/04, Jeff Mathis wrote:
but there are ways to get this value. The Java API handles this case
just fine, and I'd be willing to bet other API's do it as well.
I know that, but that isn't what he asked.
here's some simple code to do with the Java API:
String sql = some insert
returning ID:
Hi list peeps
In many of my projects I have the need to insert a new record into a
table and then later on in the script update this record, Right now I am
doing this by doing the insert, then immediately doing a Select to
return the latest id (unique id) which I store later