Understanding Sequences in Transact-SQL (SQL Study Material)
SQL Study Material (Good Documentation)
If you are a Database Developer or a Database Admin, you know for sure that knowing SQL comes handy when solving Business questions. The documentation website for T-SQL will explain various Aggregation Functions. The link can be found here.
1. Understanding Sequences in Transact-SQL, just like Identity columns, when inserting into a table instead of calling NEXT_VALUE_FOR function every time when using Identity.
Question: Why would a developer use sequences instead of Identity columns?
Login to See the Rest of the Answer
Answer: For example, when the application needs to reserve 10 sequence numbers, requesting values from Identity Columns could result in skipping some values or duplicates. A developer can use sp_sequence_get_range to retrieve several numbers in the sequence at once.
- There are limitations to using sequences, unlike Identity Columns whose values cannot be changed, sequence values are not automatically protected after insertion into the table.