Hello Elke,

   thank you for your help, using of sequences will solve my problem.

   With best regards,

   Julian Legeny

Friday, December 9, 2005, 8:03:28 AM, you wrote:

ZE> Julian Legeny wrote:
>> 
>> Hello,
>> 
>>    Is  there  possibility  to  insert NEGATIVE numbers (less than
ZE> zero)
>> into the
>> column of SERIAL datatype?
>> 
>>    For example:
>>    ------------
>>    I have table:
>> 
>>    create table TEST
>>    (
>>       ID SERIAL,
>>       NAME VARCHAR(100) NOT NULL,
>>       CONSTRAINT TEST_PK PRIMARY KEY (ID)
>>    )
>> 
>>    and I would like to insert column ID = -1, NAME = 'name1'
>> 
>>    insert into TEST (ID, NAME) values (-1, 'name1')
>> 
>>    but I receive error:
>>    ---- Error -------------------------------
>>    Auto Commit: On, SQL Mode: Internal, Isolation Level: Committed
>>    General error;300 POS(1) Integrity violation
>>    insert into TEST (ID, NAME) values (-1, 'name1')
>>    ------------------------------------------
>> 
>>    How  can I use column to be auto incremented and also I can insert
>> NEGATIVE
>> INTEGER values into this column by myself? Positive numbers is
ZE> possible
>> insert
>> without problems.
>> 

ZE> It is not possible with datatype / default serial.
ZE> Therefore real auto-increment will not be possible with negative values.
ZE> But you may create a sequence (increment by 1), create your table with
ZE> id fixed (10) and use the sequence-value in the insert

ZE> Insert into test (seq.nextval, 'name1').
ZE> In this table your insert with -1 would be possible, too.

ZE> Elke
ZE> SAP Labs Berlin


>>   Thanks for answer,
>>   best regards,
>> 
>>   Julian Legeny
>> 
>> mailto:[EMAIL PROTECTED]




-- 
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to