Re: SERIAL data type
Posted in 1995
Topics: Data Types & Schema Design, Migration, Import/Export & Data Conversion
please, correct me if i'm wrong, but i thought that:
given the schema:
create table test_table
(
serial_col serial
)
you could:
insert into test_table values (1000)
and a row will be inserted with serial_col = 1000 (assuming there is no row
in the table aready with a value of 1000), and a subsequent insertion of:
insert into test_table values (0)
will insert a row with serial_col = 1001
-joe-
(huddles@hasting.com)
----------
From: ilist
To: informix-list
Subject: Re: SERIAL data type
Date: Thursday, June 22, 1995 8:53PM
[SNIP]
>
>Serial values will automatically wrap around to an unused value, presumably
>1 when they exceed the max. There is no easy way to insert specific values
>into serial columns. (There is some way to unload and load values, I
think,
>but I have forgotten what that is.)
>
>Been to Eire, and missing it a lot...
> __________________________________________________________________
> | Clem Akins Standard Disclaimers Apply |
> |Reynolds Metals Co, Alloys Plant "Climb High, Cave Deep!" |
> | Muscle Shoals, Alabama USA cwakins@leia.alloys.rmc.com |
> |________________________________________________________________|
There is a way to insert specific values, but it's not easy.
1. Alter table from serial to integer.
2. Drop the index.
3. Insert values.
4. Create unique index.
5. Change type from integer back to serial. Specify new starting above the
last
number you entered.
I've done this a couple of times. nb: Do you backups first, and make sure
they
are readable!
Jeff Cauhape