Chris Davis wrote: > > I have a remote connection to a MySQL database. I have a remote view > working from a PK on that table. The PK is an autoinc field. I can > add > records to the table and do a successful tableupdate, but how do I > find out > on my newly added record what the value of the autoinc field is ? >
Chris:
You can use the @@IDENTITY value to return the last autoincremented value:
? SQLEXEC(1, "create table test.test (testkey int auto_increment primary key, field1 char(10))") ? SQLEXEC(1, "insert into test.test (field1) values ('test')") ? SQLEXEC(1, "insert into test.test (field1) values ('test2')") ? SQLEXEC(1, "insert into test.test (field1) values ('test3')") ? SQLEXEC(1, "select @@identity from test.test") DISPLAY
©2004 Ted Roche |