Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 17 » SQL Anywhere Server - SQL Reference » SQL statements » Alphabetical list of SQL statements


Alters a sequence.

ALTER SEQUENCE [owner.]sequence-name
[ RESTART WITH signed-integer ]
[ INCREMENT BY signed-integer ]
[ MINVALUE signed-integer | NO MINVALUE ]
[ MAXVALUE signed-integer | NO MAXVALUE ]
[ CACHE integer | NO CACHE ]
  • RESTART WITH clause

    Restarts the named sequence with the specified value.

  • INCREMENT BY clause

    Defines the amount the next sequence value is incremented from the last value assigned. The default is 1. Specify a negative value to generate a descending sequence. An error is returned if the INCREMENT BY value is 0.

  • MINVALUE clause

    Defines the smallest value generated by the sequence. The default is 1. An error is returned if MINVALUE is greater than ( 2^63-1) or less than -(2^63-1). An error is also returned if MINVALUE is greater than MAXVALUE.

  • MAXVALUE clause

    Defines the largest value generated by the sequence. The default is 2^63-1. An error is returned if MAXVALUE is greater than 2^63-1 or less than -(2^63-1).

  • CACHE clause

    Specifies the number of preallocated sequence values that are kept in memory for faster access. When the cache is exhausted, the sequence cache is repopulated and a corresponding entry is written to the transaction log. At checkpoint time, the current value of the cache is forwarded to the ISYSSEQUENCE system table. The default is 100.

  • CYCLE clause

    Specifies whether values should continue to be generated after the maximum or minimum value is reached.


If the named sequence cannot be located, an error message is returned.


You must be the owner of the sequence, or have one of the following privileges:

  • ALTER ANY SEQUENCE system privilege
  • ALTER ANY OBJECT system privilege
Side effects


  • ANSI/ISO SQL Standard

    The ALTER SEQUENCE statement is part of optional ANSI/ISO SQL Language Feature T176. The CACHE clause is not in the standard.


The following example sets a new maximum value for a sequence named Test:

   MAXVALUE 1500;