Home > Articles > Data > Oracle

  • Print
  • + Share This
From the author of

ASA: Default

On Sybase's ASA, you define autonumbering as a default in the CREATE TABLE statement. The column must be integer or exact numeric datatype, and performance is best if the column is defined as PRIMARY KEY or is the first column of an index. This allows the system to find the high value without searching the entire table.

Adaptive Server Anywhere

create table testseq
(num int not null default autoincrement,
name varchar(10) not null)

[table created]

When you INSERT rows, you give a value for the name column, but none for num:

Adaptive Server Anywhere

insert into testseq (name)
values ('Amir')

insert into testseq (name)
values ('Marge')

insert into testseq (name)
values ('Tri')

[3 rows]

A SELECT shows sequential numbers in the num column.

Adaptive Server Anywhere

select *
from testseq
    num name   
=========== ==========
     1 Amir
     2 Marge
     3 Tri

[3 rows]
  • + Share This
  • 🔖 Save To Your Account