I know that the documentation mentions that you can use ALTER TABLE
to reset a serial column, but I have yet to figure it out. Instead,
you should insert the maximum allowed value into the serial column
and force it to cycle back to 1. You can then delete the row if you
don't want it. We do this for populating databases with test data
so that we can get reproducible results (ie. get the same serial
values out of the database).
-----------
Roger Tomas
AG Communication Systems
Example:
table is called 'tab'
column is called 'col'
required next number = 123
alter table tab modify col serial(123);
<flamebait>
Correct me if I'm wrong, everybody!!!
</flamebait>
Cheers,
Richard.
--------------------------------------------------
Ramdas Gopinath E-mail: rg...@rankin.com
602-997 6996 X125 Fax: 602-997 4256
--------------------------------------------------
Except if the table has data in, and the MAX(col) is already higher
than the required next number.
In that case the ALTER TABLE works but does nothing!
Cheers,
--
Mark.
+------------------------------------------------------------------+
|Mark D. Stock - The West Solutions Group http://www.west.co.za |
| The Informix FAQ is at http://www.iiug.org |
|mailto:ma...@west.co.za +-----------------------------------------+
|Tel: +27 11 803 2151 |If it doesn't work, force it! |
|Fax: +27 11 803 2189 |If it breaks, it needed replacing anyway!|
|Cell: +27 83 250 2325 |Well, that's how I code anyway! |
+------------------------+-----------------------------------------+
Might be wrong though its a long time since I thought I did it.
"Ramdas Gopinath" <rg...@rankin.com> wrote in article
<5oc0c3$m...@cssun.mathcs.emory.edu>...
You don't even need to do that. You CAN use ALTER TABLE to change
the next number.