SQL Server SEQUENCE is resetting itself every few days on Azure SQL.. why?
I tried to replicate your issue in my environment by creating sequence with below code:
CREATE SEQUENCE MySeqName1
start with 1
increment by 1
minvalue 0
maxvalue 5
cycle
cache 5000;
Create a table and inserted values into that by using created sequence
CREATE TABLE students
(
Id int,
Name char(20)
);
Insert into students(Id,Name) values(NEXT VALUE FOR MySeqName1, 'AA'),
(NEXT VALUE FOR MySeqName1, 'BB'),
(NEXT VALUE FOR MySeqName1, 'CC'),
(NEXT VALUE FOR MySeqName1, 'DD'),
(NEXT VALUE FOR MySeqName1, 'EE'),
(NEXT VALUE FOR MySeqName1, 'FF'),
(NEXT VALUE FOR MySeqName1, 'GG')
select * from students

I reset the sequence using below code
ALTER SEQUENCE dbo.MySeqName
RESTART WITH 4
INCREMENT BY 1
Inserted values into table sequence is repeating after max value So as @Vladimir Baranov said check the CYCLE option using below code:
SELECT is_cycling FROM sys.sequences WHERE name="MYSeqName" ;

So CYCLE is enabled for the sequence If you want to remove CYCLE option use below code:
ALTER SEQUENCE MYSeqName
NO CYCLE
After the execution of above code it is disabled

Read more here: Source link
