Last active
February 6, 2020 00:06
-
-
Save alevyinroc/00501e9edd7825a799d6f2e46f09c8f9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE TABLE SequenceHolder ( | |
| id INT identity(1, 1) | |
| ,BecauseINeedSomething BIT DEFAULT 0 | |
| ); | |
| CREATE OR ALTER PROCEDURE GetNextNumberTable | |
| AS | |
| BEGIN | |
| DECLARE @newid INT; | |
| INSERT INTO SequenceHolder (BecauseINeedSomething) | |
| VALUES (0); | |
| SET @newid = SCOPE_IDENTITY(); | |
| DELETE | |
| FROM SequenceHolder | |
| WHERE id = @newid; | |
| SELECT @newid; | |
| END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment