Rollback SQL Server 2012 Sequence
- by VAAA
I have a SQL Server 2012 Sequence object:
/****** Create Sequence Object ******/
CREATE SEQUENCE TestSeq
START WITH 1
INCREMENT BY 1;
I have a SP that runs some queries inside a transaction:
BEGIN TRAN
SELECT NEXT VALUE FOR dbo.TestSeq
<here all the query update code......>
ROLLBACK TRAN
If the transaction fails all the updates are rolledback without problem but the Sequence is not rolled back I guess because Its out of the scope of the transaction.
Any clue on way to handle that?
Thanks