Create a sequence
To create a sequence:
- In the System i Navigator window, expand the system you want to use.
- Expand Databases and the database that you want to work with.
- Expand Schemas and the schema in which you want to create the sequence.
- Right-click Sequences and select New Sequence.
- Specify a name for the sequence.
- Select a data type for the sequence.
- Specify a increment, starting value, minimum value, maximum value, and value to cache.
- If you want values to cycle after reaching their minimum or maximum, check the Cycle values when the minimum or maximum value is reached box.
- If you want to generate the values in order, check the Generate values in the order requested box.
- Specify a description in the Text field (optional).
- Click OK.
You can view the SQL used to create this object by select Show SQL. This action
launches Run SQL Scripts. You can then choose to run the SQL from the Run SQL Scripts
window. However, if you edit the SQL in the Run SQL Scripts window, the changes are not reflected back
to the dialog. Additionally, if you create the object from the Run SQL Scripts window and then click
OK on the dialog, you will receive an error.
Note: A sequence can also be created by right-clicking All Objects,
and selecting New --> Sequence. If you use this method, choose a schema in which to create the
sequence from the Schema: list on the New Sequence dialog.