Search code examples
sql-serverazure-sql-database

SQL Server SEQUENCE is resetting itself every few days on Azure SQL.. why?


Example command I am using in the query editor of Azure SQL:

ALTER SEQUENCE dbo.MySeqName
    RESTART WITH 5000  
    INCREMENT BY 1

It works fine initially, then after a few days, I check the sequence, and it has reset itself back to start at 1!

Where do I even start to troubleshoot?

EDIT: More info, just to point out explicitly that I don't expect it to cycle nor do I want it to cycle.

The MINVALUE is 1 and MAXVALUE = very large number i.e. Max BigInt.

EDIT#2: If there is some rogue or automated script that is executing and re-setting the sequence, are there history logs anywhere, or can I turn it on temporarily for, say a week to view all statements executed on Azure SQL?


Solution

  • Issue was with the behavior of Visual Studio Database Project.

    (I tried to close the question, but there was no fitting option - which is answer is not longer required, resolved by user who posted the question).