J
J
Jaguar_sea2016-04-04 10:00:30
SQL Server
Jaguar_sea, 2016-04-04 10:00:30

Is it possible to create a table with two autoincrement fields?

There is a table:

create tabel order (
   Id int IDENTITY(1,1) NOT NULL,
   Number int NOT NULL
)

Question: How can I make the "Number" field auto-increment? It is clear that one table cannot have more than one auto-increment field, but perhaps there are some workarounds?
It seems that in the new versions of Microsoft SQL Server there are so-called "Sequences", with the help of which the problem is solved.
If we exclude this option, what are the best practices for solving this problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2016-04-04
@korolevdd

CREATE SEQUENCE?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question