I have 2 virtually identical tables and wish to move data between them.
Basically one table is called "live_table" and the other is named
"suspended_table" and the only difference is that the primary key in the
"suspended_table" is an auto incremented integer where as "live_table"
primary key is just a standard integer.
Here's the life-cycle:
1. Record gets entered into "suspended_table"
2. Record checked and then inserted into "live_table" with now corresponding
record deleted in "suspended_table"
3. Record (after period of time) is moved back into "suspended_table"
Here's now my question. Does the primary key integer value change when it
moves back to the suspended table (as specified in point 3)? Will it see the
returning record as simply a new one, overwrite the existing primary key
value and give it the next available? Is there a way stopping assigning an
auto incremented number if a value already exists?
I have some ideas for workarounds such as actually not deleting the record
in the suspended table but instead adding an extra field to act as a flag.
This I assume can be set or unset by the use of a trigger. Never tried this
but read these work "when an INSERT, UPDATE, or DELETE statement is issued
against the associated table or when database system actions occur."*
Cheers
Phil
* taken from:
http://www.experts-exchange.com/Data..._20958686.html