Skip to content

Instantly share code, notes, and snippets.

@ebenito
Last active March 6, 2019 07:59
Show Gist options
  • Save ebenito/062e7aad598ee732ffffac30d6b1d032 to your computer and use it in GitHub Desktop.
Save ebenito/062e7aad598ee732ffffac30d6b1d032 to your computer and use it in GitHub Desktop.
Reiniciar indentidad tabla
-- 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