Why SEQUENCE is used in SQL?

411 views Asked by At

I am brushing up my knowledge about SQL and I am learning more and more. However, I am not understanding the purpose of the Sequence we use. I am using SQL Server.

1

There are 1 answers

1
Zakaria On

The sequence object is an alternative, more flexible key-generating mechanism than identity. Unlike identity, it’s not tied to a particular column in a particular table. Whenever you need to generate a new value, you invoke a function against the object and use the returned value wherever you like. It also supports specifying a minimum value and a maximum value, and cycling too.