Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2002
    Posts
    15

    Question Unanswered: Getting highest value and resetting sequence

    Help,

    I want to find out what the highest value within my sequence is so I can manually insert 200 rows and then reset the sequence to [existing_value] + 201.

    How can I do this? I have done it before with MAX() or something similar but it was so long ago I can't remember or find the command I used ....

    Thanks
    Shannon
    Shannon Whitty
    reynolds.com.au

  2. #2
    Join Date
    Nov 2002
    Posts
    15

    Re: Getting highest value and resetting sequence

    I believe I have found the answer:

    To get the max value I execute:

    SELECT NEXTVAL FOR [SCHEMA].[SEQUENCE_NAME] FROM [DB2SYSSCHEMA].DUAL

    Then to reset I execute:

    ALTER SEQUENCE [SCHEMA].[SEQUENCE_NAME] RESTART WITH [NUMERIC_VALUE]


    Thanks
    Shannon Whitty
    reynolds.com.au

Posting Permissions

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