Created
October 16, 2025 08:11
-
-
Save ststeiger/d6d62d627f91b8a4ab2406b1bc2f375b to your computer and use it in GitHub Desktop.
Restart sequence in MS-SQL
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
| DECLARE @sql national character varying(1000); | |
| DECLARE @restart_value bigint; | |
| SET @restart_value = ISNULL( | |
| ( | |
| SELECT ISNULL(MAX(ifcd_drawing_id), 0) FROM ifc.ifc_drawings | |
| ) | |
| , 0) + 1; | |
| -- SELECT @restart_value AS restart_value; | |
| -- ALTER SEQUENCE ifc.ifc_drawings_seq RESTART WITH @restart_value; | |
| SET @sql = 'ALTER SEQUENCE ifc.ifc_drawings_seq RESTART WITH ' + CAST(@restart_value AS national character varying (36)) + '; '; | |
| -- SELECT @sql; | |
| EXECUTE(@sql); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment