Last active
March 6, 2019 07:59
-
-
Save ebenito/062e7aad598ee732ffffac30d6b1d032 to your computer and use it in GitHub Desktop.
Reiniciar indentidad tabla
This file contains 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
-- Al vaciar la tabla | |
delete NombreTabla | |
DBCC CHECKIDENT ('NombreTabla', RESEED, 0); | |
-- Al siguiente valor | |
declare @max int | |
SELECT @max=max([Id]) FROM NombreTabla | |
if @max IS NULL | |
SET @max = 0 | |
DBCC CHECKIDENT ('[NombreTabla]', RESEED, @max) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment