Troubleshooting Guide: Error 11710 — ‘START WITH’ Cannot Be Used in ALTER SEQUENCE
Why This Error Happens
This error occurs because the START WITH argument is only valid when creating a sequence object with CREATE SEQUENCE, not when modifying an existing one. SQL Server 2025 strictly validates ALTER SEQUENCE syntax, and START WITH is reserved exclusively for defining the initial value at object creation time. Attempting to reuse this clause during an ALTER operation triggers a parser-level rejection rather than a permissions or connectivity issue.
Step-by-Step Resolution Guide
Step 1: Review the ALTER SEQUENCE Syntax
- Open SQL Server Management Studio (SSMS) or Azure Data Studio connected to your SQL Server 2025 instance.
- Confirm that your script uses
RESTART WITHinstead ofSTART WITHwhen modifying an existing sequence’s current value. - Example of the invalid statement:
ALTER SEQUENCE dbo.MySequence START WITH 100;
Step 2: Correct the Statement Using RESTART WITH
- Replace
START WITHwithRESTART WITHto reset the sequence’s next value without recreating the object. - Correct syntax:
ALTER SEQUENCE dbo.MySequence RESTART WITH 100; - If you need to change increment, min/max, or cache settings, these remain valid in ALTER SEQUENCE (e.g.,
INCREMENT BY,MINVALUE,MAXVALUE,CACHE).
Step 3: Drop and Recreate the Sequence (If Initial Definition Must Change)
- If you genuinely need to redefine the original starting point permanently (not just restart the counter), drop and recreate the sequence instead.
- Run:
DROP SEQUENCE dbo.MySequence;followed byCREATE SEQUENCE dbo.MySequence START WITH 100 INCREMENT BY 1; - Update any dependent stored procedures, views, or applications referencing the sequence object, since dropping it may affect permissions and object dependencies.
Step 4: Validate Permissions and Script Source
- Check that the script or application generating the ALTER statement (ORM tools, migration scripts, deployment pipelines) is using the correct T-SQL syntax for SQL Server 2025.
- Search your codebase or deployment templates (e.g., in
C:\Scripts\or your CI/CD pipeline YAML files) for legacySTART WITHusage in ALTER statements and update them toRESTART WITH.
Alternative or Verification Steps
- Verify the fix by querying
sys.sequencesto confirm thecurrent_valuecolumn reflects the expected restart value:SELECT name, current_value FROM sys.sequences WHERE name = 'MySequence'; - If the error persists after correcting syntax, check SQL Server’s compatibility level (
SELECT compatibility_level FROM sys.databases WHERE name = 'YourDatabaseName';) to ensure the database isn’t running under an older compatibility mode that may affect sequence behavior.