Paul
|
Posted: 01/08/2002, 1:50 AM |
|
I know this is a simple question, i am using ASP with mySQL:
On insert i want to check the highest current vacancy_id then add 1 to this to make a new vacancy_id for the inserted record.
Thanks in advance
|
|
|
Alex Alexapolsky
|
Posted: 01/08/2002, 2:28 AM |
|
This should be done automatically in mysql.
Set your field type to autoincrement.
|
|
|
Paul
|
Posted: 01/08/2002, 2:32 AM |
|
Thanks alex,
this would work, but if i wanted to do it manually how would i go about it? I need it to on insert select the hightest current id (MAX?) and then add 1 in order to create the next id?
Thanks in advance
|
|
|
K Williams
|
Posted: 01/10/2002, 8:22 AM |
|
I was wondering if you have an example of retrieving the value of an AutoIncrement field from Oracle using Java.. Here is what I am doing but it is not working.
sSQL = "SELECT max(requests.coa_req_id)
from coa_requests where coa_requests.coa_timestamp = "toSQL(fldCOA_TIMESTAMP, Text_TYPE);
openrs rs, sSQL
String lastReqId = getValue(rs, "requests.coa_req_id");
session.....
Any assistance would be appreciated.
|
|
|
B Kinser
|
Posted: 08/22/2003, 1:37 PM |
|
if you are using oracle that wont work, you have to nest 2 select statements in order to limit the results size
ex:
SELECT * FROM (SELECT fn_batch.bizflowbatchprocessid, fn_bundle.bizflowbundleprocessid, fn_bundle.batchqty bundleqty, fn_batch.documentqty batchqty, fn_bundle.mailtype, fn_batch.currentstatus batchstatus, fn_batch.scandatetime, fn_batch.batchname FROM fn_bundle, fn_batch WHERE ((fn_batch.bundleid = fn_bundle.bundleid) AND (fn_bundle.sourcetype = 'POBox') AND (fn_bundle.sourcedata = '" + poSel + "')) ORDER BY fn_batch.bizflowbatchprocessid DESC) where ROWNUM < '25'";
agtPO.execute(sqlPO);
|
|
|
|