Re: Changing serial value
Posted in 1997
marko kopac wrote:
>
> I don't know how to change a serial value in a table (Informix
> database). I need this to copy a record to the same table. First I copy
> a record to a temp table. There I try to change the serial value and
> then to insert to the original table. This is my idea. Has anybody some
> another idea hove to solve this problem?
If you use "SELECT * FROM ... INTO TEMP mytemptable" to create the temp
table the temp table will be created with a serial column and you still
will not be able to update the serial number. Just create the temp
table explicitely with an integer rather than serial and insert into it.
Ex:
create temp table copy_cache {
was_serial integer,
...};
insert into copy_cache select * from orig_table where ... ;
update copy_cache set was_serial = 12345 where was_serial = ... ; ^^^^^ make sure this does not exist
in the original table.
insert into orig_table select * from was_serial;
drop table caopy_cache;
Art S. Kagel