SQLCA.SQLERRD[2]
Posted in 1999
Topics: Migration, Import/Export & Data Conversion
We have an application that does
LET field1 = SQLCA.SQLERRD[2]
field1 is an integer field
In june we moved platforms so we did dbexport and dbimport to move the
database to the new platform. At that time the value of SQLCA.SQLERRD[2]
reverted to 1. Unfortunately it was not until now that we discovered this
and we now have rows with duplicate values in field1.
My question is can I somehow input a starting value for SQLCA.SQLERRD[2] and
have it increment from there?
Thanks
--
Gerard MacNeil
M.F. Schurman Company, Limited
gerardm@schurmans.com
http//:www.schurmans.com
gerard wrote:
> We have an application that does
> LET field1 = SQLCA.SQLERRD[2]
> field1 is an integer field
Hmmm; the conversation would lead me to think that field1 is a variable of type
INTEGER,
and is supposed to store a value corresponding to a SERIAL column in the
database.
> In june we moved platforms so we did dbexport and dbimport to move the
> database to the new platform. At that time the value of SQLCA.SQLERRD[2]
> reverted to 1.
Well, only if you didn't insert any data into the table. If you transferred any
data, then
the highest stored value would have been used to reset the next serial value.
So, is this
a 'ticket counter' table, which is normally empty except briefly when you insert
a row for
sole purpose of getting a new serial value? That would do it?
> Unfortunately it was not until now that we discovered this
> and we now have rows with duplicate values in field1.
Why wasn't there a unique index to prevent this collision?
Well, too late now; you'll need to add it once you've got it all fixed, though.
> My question is can I somehow input a starting value for SQLCA.SQLERRD[2] and
> have it increment from there?
Yes:
INSERT INTO SomeTable(Field1) VALUES(237743);
DELETE FROM SomeTable WHERE Field1 = 237743;
I am assuming that this is a SERIAL column we're dealing with...
--
Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net)
Guardian of DBD::Informix v0.62 -- see http://www.perl.com/CPAN
#include <disclaimer.h>