seq

Returns a sequence number. The number can be initialized to any value, and the increment can be defined for each call. The syntax is:

seq(increment [, init])

If init is given then the sequence number is initialized to that value, which will be the value returned. It is then incremented by increment. If init is not specified then the current value will be retained. The initial value will be zero if init has not been specified.

Examples of typical use:

SELECT  NAME, seq(1)
     FROM    SYSTABLES

The results are:

NAME                seq(1)
 SYSTABLES               0
 SYSCOLUMNS              1
 SYSINDEX                2
 SYSUSERS                3
 SYSPERMS                4
 SYSTRIG                 5
 SYSMETAINDEX            6

SELECT  seq(0, 100)
     FROM    SYSDUMMY;

     SELECT  NAME, seq(1)
     FROM    SYSTABLES

The results are:

seq(0, 100)
     100

  NAME                seq(1)
 SYSTABLES             100
 SYSCOLUMNS            101
 SYSINDEX              102
 SYSUSERS              103
 SYSPERMS              104
 SYSTRIG               105
 SYSMETAINDEX          106

Copyright © Thunderstone Software     Last updated: Oct 5 2023
Copyright © 2024 Thunderstone Software LLC. All rights reserved.