View Single Post
  #20  
Old September 26th, 2005, 10:27 AM
external usenet poster
 
Posts: n/a
Default


Denis wrote:
By re-loading I mean empty/recreate the table and put the data back again.
Why would you do this? Perhaps recovery from corruption etc...

If you back up a table with an autonumber field and there are gaps in the
number sequence due to deletions what happens to the autonumber field if you
restore from this backup?


You can INSERT explicit values into an autonumber (COUNTER) column:

CREATE TABLE Test (
key_col COUNTER NOT NULL,
data_col INTEGER NOT NULL)
;
INSERT INTO Test (key_col, data_col) VALUES (2147483647,1);
INSERT INTO Test (key_col, data_col) VALUES (-2147483648,2);
INSERT INTO Test (data_col) VALUES (3);

So you can use an INSERT INTO...SELECT construct to reload your table
using explicit values for the autonumber.