- ASA: Default
- Transact-SQL: Column Property
- Oracle: CREATE SEQUENCE
- Informix: SERIAL Datatype
- Associated Issues
Like this article? We recommend
Transact-SQL: Column Property
In Transact-SQL, the autonumbering feature is a column property rather than a default. Microsoft SQL Server and Sybase ASE have the same approach, but show some differences.
In Microsoft SQL Server, IDENTITY can take start and increment values (here it is set to start at 1 and increment by 1).
Microsoft SQL Server
create table testseq (num int not null identity (1,1), name varchar(10) not null) The command(s) completed successfully.
You INSERT just as in ASA, and when you look at the rows, you see the automatically inserted numbers.
MS SQL Server
insert into testseq (name) values ('Amir') .... select * from testseq num name ----------- ---------- 1 Amir 2 Marge 3 Tri (3 row(s) affected)