Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2007
    Posts
    3

    Unanswered: Please help:Sequence question?

    Hi All,

    I have created a sequence and my sequence number should not restart with 1 after reaching the maximum value.After reaching the maximum value 100 it should give error.Please reply to this query

    please find below the code :
    CREATE SEQUENCE pos AS INTEGER START WITH 1 INCREMENT
    BY 1 MAXVALUE 100 CYCLE CACHE 5

    ALTER SEQUENCE pos RESTART WITH 1 INCREMENT BY 1
    MAXVALUE 100 CYCLE CACHE 5


    Thanks to all.

  2. #2
    Join Date
    Jun 2006
    Posts
    471

    sequence

    I don't think this is possible.
    in that case you have to maintain it yourself and save it in a table
    Best Regards, Guy Przytula
    DB2 UDB LUW certified V6/7/8

  3. #3
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Quote Originally Posted by mary76
    I have created a sequence and my sequence number should not restart with 1 after reaching the maximum value...

    please find below the code :
    CREATE SEQUENCE pos AS INTEGER START WITH 1 INCREMENT
    BY 1 MAXVALUE 100 CYCLE CACHE 5
    If you don't want it to cycle, why do you define it with CYCLE?
    ---
    "It does not work" is not a valid problem statement.

  4. #4
    Join Date
    May 2006
    Posts
    82
    I dont have much idea about SEQUENCE. I think you can put a check constraint for that column like all the values should be less that 100. I agree this may not be a good idea, if you have the option of controlling it in SEQUENCE object itself.

Posting Permissions

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