Skip to main content

Reference

 

OutSystems

Auto Numbers on Database

When modeling Entities to store data on the database, you can make Integer attributes auto numbers to ensure they have unique values for each record.

This page explains what happens on the database when setting an attribute IsAutoNumber property to Yes.

SQL Server

When creating a sequential attribute with a SQL Server database, a column with Int data type, and with Identity (1,1) is created. This ensures the value starts at 1, and is incremented by 1, each time a new record is inserted.

CREATE TABLE Product (
  Id INT IDENTITY(1,1),
  Name VARCHAR(50)
)

Oracle

In Oracle, a sequential attribute is mapped to the following Oracle objects:

  1. A sequence, prefixed with OSSEQ, is created to guarantee the uniqueness of the corresponding column. This sequence starts at 1 and has an increment of 1;
  2. A trigger, prefixed with OSTRG, is created in order to calculate the next value of the sequence. This trigger is invoked before inserting new records.

MySQL

In MySQL, a sequential attribute is mapped in a column of type Integer with the AUTO_INCREMENT attribute. This attribute indicates to the MySQL database that this column uses sequential numbers that start at 1.

CREATE TABLE Product (
  Id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
  Name NVARCHAR(50)
)
  • Was this article helpful?