Hi,
INSERT INTO navn IN '\\path\to\sendtil.mdb'
SELECT navn
FROM tbl_navn
WHERE skal_digitaliseres=True And sendt_til_dig=False;
I use this for inserting data in db2, from db1.
This query works perfectly!
But:
I have to insert in another table, in db2 too.
This is why I would need to retrieve the insert_id (autonumber) from the previous query!
How do I find this?
I'm used to use PHP/mySQL
I dont think it's a good sollution to run a query and retrieve the ID with the highest number.
The thing is, that people might use the db2, while db1 is inserting in db2. Also, the first query should only insert, if it is not stored there already!
Maybe I have to explain some more:
db1 has one table for customer and order
if order is digital, the database should query db2 and check if the customer is stored there in db2.table1
if user is stored there, simply insert order in db2.table2
if user is not stored, insert customer in db2.table1, retrieve the insert_id and use that insert_id for inserting order in db2.table2
Is this possible? I think it should be, as it's very easy to do in mySQL.
ps. it's non profit! I'm doing service for the community. (preservation of books, etc.) and this should copy orders which want digital results (scanned, etc.).
Olav Alexander Mjelde
Admin & Webmaster
INSERT INTO navn IN '\\path\to\sendtil.mdb'
SELECT navn
FROM tbl_navn
WHERE skal_digitaliseres=True And sendt_til_dig=False;
I use this for inserting data in db2, from db1.
This query works perfectly!
But:
I have to insert in another table, in db2 too.
This is why I would need to retrieve the insert_id (autonumber) from the previous query!
How do I find this?
I'm used to use PHP/mySQL
I dont think it's a good sollution to run a query and retrieve the ID with the highest number.
The thing is, that people might use the db2, while db1 is inserting in db2. Also, the first query should only insert, if it is not stored there already!
Maybe I have to explain some more:
db1 has one table for customer and order
if order is digital, the database should query db2 and check if the customer is stored there in db2.table1
if user is stored there, simply insert order in db2.table2
if user is not stored, insert customer in db2.table1, retrieve the insert_id and use that insert_id for inserting order in db2.table2
Is this possible? I think it should be, as it's very easy to do in mySQL.
ps. it's non profit! I'm doing service for the community. (preservation of books, etc.) and this should copy orders which want digital results (scanned, etc.).
Olav Alexander Mjelde
Admin & Webmaster