SQL for Smarties | SQL Programming Style | Trees and Hierarchies in SQL | SQL Puzzles and Answers | Data and Databases


Wednesday, May 17, 2006

DB2: restart sequence number

SQL Apprentice Question
How to restart sequence number once the data is imported/loaded into
the tables?


Celko Answers

>> How to restart sequence number once the data is imported/loaded into the tables? <<


The kludge is ALTER SEQUENCE.

The right answer is that you should not have to do a re-sequence. This
will change the values in that column, and thus the meaning of the
rows.


Surely you did not use this as an exposed physical locator to mimic a
magnetic tape file! It must have meaning in your data model and not in
the physical storage for this to be a relational design.

No comments: