Hi all,
i have a problem with serial columns.

I need to define a few tables in sapdb with key columns with a default serial.
The data in these tables will be imported from SqlServer 7.0.
The tables in SqlServer include key columns with a default serial 
and records having a key value equal to zero (one for each table, of course).
If I for instance create the sapdb table TABLE1 with this code:

CREATE TABLE TABLE1(
ID INTEGER NOT NULL DEFAULT SERIAL(1),
DESC VARCHAR(50) NULL,
PRIMARY KEY (ID)
)

and I import only the records having ID > zero
everything works and sapdb recognizes the default serial 
(records inserted afterwards are managed correctly).

The problem is I need to insert records having ID=zero too.
If I first import data in a sapdb table created without a default serial (so that I 
don't encounter any error while importing)
and then add the default serial, the records inserted afterwards have a key ID 
starting from 1 and not the latest value of the ID
existing in the table TABLE1.

Is there a way to assign a starting value to a default serial in a certain table?
Is this value maybe memorized in a system table?

Please keep in mind I don't want to further define other structures like sequences 
instead of using a serial column. 

Can you please help me to solve this problem? 
Is there any documentation that I may read concerning this problem?

Thank you,

Francesco

Reply via email to