Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2014

    Unanswered: Simple query: Serial column value after insert


    I have a simple informix query that I hope you can help with. I don't have access to an informix db right now so I can't run a test to find the answer to my query.

    If I have a table with a serial column:

    CREATE TABLE newtab ( newcol SERIAL);

    And the internal counter is set to 10 by inserting a value of 10:

    INSERT INTO newtab VALUES ( 10 ); -- internal counter = 10

    If I then insert some lower values, ie:

    INSERT INTO newtab VALUES ( 5 );
    INSERT INTO newtab VALUES ( 6 );
    INSERT INTO newtab VALUES ( 7 );

    Would the value of the serial column remain unchanged?

    I'm trying to figure out if inserting a bunch of lower id rows into the table would affect the value of the serial field.

    Thanks in advance!
    Last edited by anni01; 07-17-14 at 15:18. Reason: fix typo

  2. #2
    Join Date
    Sep 2011
    Pont l'Abbé, Brittany, France
    Provided Answers: 1
    Hi Anni,

    the serial value will increment only if you insert the value of 0 (zero) for the serial column. if not zero, it will take the value provided by your application.

    THe last case is something I would recommand to do with extrememe precaution ....

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts