-1

I wonder if SQL Server's sequence objects are atomic in increasing their internal counter as it happens with help of Interlocked.Increment() method. Who knows?

Nick Reshetinsky
  • 447
  • 2
  • 13
  • 1
    Does this answer your question? [Is a single SQL Server statement atomic and consistent?](https://stackoverflow.com/questions/21468742/is-a-single-sql-server-statement-atomic-and-consistent) and [Atomic retrieving sequential range from SEQUENCE](https://stackoverflow.com/questions/36407983/atomic-retrieving-sequential-range-from-sequence) –  Aug 08 '21 at 16:45

1 Answers1

2

I wonder if SQL Server's sequence objects are atomic in increasing their internal counter as it happens with help of Interlocked.Increment() method.

Yes. SEQUENCE objects are guaranteed to never create the same NEXT VALUE multiple times, even if multiple sessions request the NEXT VALUE simultaneously.

David Browne - Microsoft
  • 80,331
  • 6
  • 39
  • 67