RE: Serial field and insert, maybe a very stupid question
Posted in 2008
An insert into a table with a serial column will have the highest serial value+1, that is all a serial column does, to ensure uniqueness you must an a unique index as well. A lot of people miss this part of it assuming a serial column also enforces unique values
Regards Colin There are 10 types of people in the world, those that understand binary and those that don't
Subject: Serial field and insert, maybe a very stupid questionDate: Wed, 6 Aug 2008 14:27:14 +0200From: Joerg@it-volz.deTo: informix-list@iiug.org
Hy,
I have two identical tables on two different IDS 10 Servers.
Both tables look exactly the same, structure like that:
create table tblSomething{
idxodbc serial,
Textfield char(20)
}
Both tables have the same data, 12 rows with idbxodbc from 1 to 12 and some text in each row.
1 SomeText
2 Moretext
...
12 lasttext
Now I did an
INSERT INTO tbSomething -- working on Server1
SELECT *
FROM database@Server2:tblSomething
I expected to get a hit on my finger for writing exactly the same Values in a serial defined field, but the Insert just ran and I ended up with two rows with idxodbc=1, two rows with idxodbc=2 and so forth...
1 SomeText
1 SomeText
2 Moretext
2 Moretext
...
12 lasttext
12 lasttext
Is this normal behaviour? I am very surprised, but it has been a long time since I tried to mess up with serial defined fields. (once with Online 4.x when I started Informix)
regards,
Joerg Volz
IT Handel und Beratung Jörg VolzBernhard-Früh-Str. 777855 AchernGERMANY
Tel: 07841-681651Fax: 07841-681654Mobil: 0170-2989757Ust-ID: DE201383541
http://www.it-volz.de
_________________________________________________________________
Win a voice over part with Kung Fu Panda & Live Search and 100’s of Kung Fu Panda prizes to win with Live Search
http://clk.atdmt.com/UKM/go/107571439/direct/01/