my code stock.com

Instrucciones para agregar identity, para modificar y para la identificación de secuencia en tablas con indice

Snippet options

Download: Download snippet as identity.sql.
Copy snippet: For this you need a free my code stock.com account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!

--Checar las tablas que contienen identity
--y checa cual es el tipo de consecutivo que susa

SELECT TABLE_SCHEMA, TABLE_NAME, 
   IDENT_SEED(TABLE_SCHEMA + '.' + TABLE_NAME) AS IDENT_SEED
FROM INFORMATION_SCHEMA.TABLES
WHERE IDENT_SEED(TABLE_SCHEMA + '.' + TABLE_NAME) IS NOT NULL;
GO

-- Checa la información de las tabals con sus respectivos indices
--increment_value: valor de incremento
--last value: último valor del seed
select * from sys.identity_columns

-- Cambiar el valor del identity
DBCC CHECKIDENT (Entidad, RESEED,0)

-- Checar el valor del identity
DBCC CHECKIDENT (Entidad)

Create a free my code stock.com account now.

my code stok.com is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!

Find out more and register now

You can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.