We have 2 environments: Test and Production. From time to time, after we mess the data in Test, we copy all tables from Production to Test. (By ‘we’ I mean out DBA.) He had to also re-set all sequences because – for some reason – you cannot copy sequences (or can you?).
But now instead of a Trigger and a Sequence (to keep track of Primary Key in a table) we can use an IDENTITY field, where the next value of the PK is a part of the script. Something like:[tt]
ID NUMBER(38) GENERATED ALWAYS AS IDENTITY ( START WITH [blue]18[/blue] MAXVALUE 9999999999999999999999999999 MINVALUE 1 CYCLE NOCACHE ORDER KEEP) NOT NULL,[/tt]
So the next record will have a PK value of [blue]18[/blue]
How does that work if we want to Copy Production tables to Test?
Tables used to be Truncated and re-populated with the new data. But now, do we need to Drop tables and re-create them again because of the IDENTITY field?
---- Andy
There is a great need for a sarcasm font.
But now instead of a Trigger and a Sequence (to keep track of Primary Key in a table) we can use an IDENTITY field, where the next value of the PK is a part of the script. Something like:[tt]
ID NUMBER(38) GENERATED ALWAYS AS IDENTITY ( START WITH [blue]18[/blue] MAXVALUE 9999999999999999999999999999 MINVALUE 1 CYCLE NOCACHE ORDER KEEP) NOT NULL,[/tt]
So the next record will have a PK value of [blue]18[/blue]
How does that work if we want to Copy Production tables to Test?
Tables used to be Truncated and re-populated with the new data. But now, do we need to Drop tables and re-create them again because of the IDENTITY field?
---- Andy
There is a great need for a sarcasm font.