Support for sequences

Related products: Software Factory

All supported databases support the concept of sequences. To clarify what a sequence is, I'll quote Microsoft:



A sequence is a user-defined schema bound object that generates a sequence of numeric values according to the specification with which the sequence was created. The sequence of numeric values is generated in an ascending or descending order at a defined interval and can be configured to restart (cycle) when exhausted. Sequences, unlike identity columns, are not associated with specific tables. Applications refer to a sequence object to retrieve its next value. The relationship between sequences and tables is controlled by the application. User applications can reference a sequence object and coordinate the values across multiple rows and tables.


Sequences are quite useful in various scenario's, for example to assign (unique) batch-numbers the products that have been produced and are being stored in a stock table.



I think it would be useful if we could make use of these sequences and be able to define them within the Software Factory. I think the best place to define them would be at the datamodel-level.

It should have options like:


  • Name
  • Datatype
  • Start with value
  • Increment value
  • Min value (optional)
  • Max value (optional)
  • Cycle (no/yes)
I'm currently using sequences, but it would be very usefull if it's supported by default. The benefits of using a sequence is that it's always unique, and it could be formatted with some helper functions and tables. Just using 'an ID' is not an option, when the unique number is going to be used in production. They are simply just not human readable enough.



I.e. a product batch number which is more readable. A format could be i.e. RUN19-0034X, where RUN19- is the prefix, X the suffix and 0034 is the generated sequence number with a fill of 4 characters. I'm currently creating the sequences manually, incl. granting access. It's all wrapped with a stored procedure to apply the pre/postfix to it.
Updated idea status On the backlogPlanned

Sequences can be created in the upcoming 2021.2 version of the Software Factory. The new sequences screen can be found under Data in the menu.

Adding a sequence in the Software Factory

When a sequence is created it will be generated to its own code file which can be run on the database. The current implementation of sequences does not allow them to be used as a replacement for identity columns. Sequences can however be freely used in any functionality, for example in defaults or default value expressions for a column.


Updated idea status PlannedNext release
Updated idea status Next releaseCompleted