If you mean resetting the next value for auto-increment field, it depends on what database type you are using. For example, for MySQL, google for “reset auto_increment mysql”.
table: table is UNION of 2 base tables namely tableA and tableB. Both have PK auto_increment.
field: field value decide which PK-id belong to which table.
Like my previous case, I have:
Row_Inserting()
if ($rsnew[“field”] === “A value”) {
// do something (like calling stored procedure).
} elseif ($rsnew[“field”] === “B value”) {
// do something else
};
Obviously I don’t need “INSERT INTO …” to any tables.
That means I don’t need this:
Row_Inserting()
if ($rsnew[“field”] === “A value”) $this->UpdateTable = “tableA”
elseif ($rsnew[“field”] === “B value”) $this->UpdateTable = “tableB” ;
So then I don’t need this either:
Row_Inserted()
if ($rsnew[“field”] === “A value”) Execute(“delete from tableA…”);
elseif ($rsnew[“field”] === “B value”) Execute(“delete from tableB…”);
Instead, to avoid those confusing codes, I create a dummy table dummy with only a PK-field and nothing else.
So now,
Row_Inserting()
if ($rsnew[“field”] === “A value”) {
// do something (like calling stored procedure, etc).
} elseif ($rsnew[“field”] === “B value”) {
// do something else
};
$this->UpdateTable = “dummy”;
Then,
Row_Inserted()
Execute(“delete from dummy …”); // I can fire this or not, whatever
This “dummy approach” also applicable to my previous case.
Bottom line: It’s not auto_increment issue but rather flexibility issue.