Omnia9
Omnia9

Reputation: 1573

Reseeding the Identity column for new records only (SQL)

I have data in a table, but am working on data loading. I want to reseed all new inserts for testing.

What would be the line to set all new inserts to a certain seed value?

Upvotes: 0

Views: 133

Answers (1)

KM.
KM.

Reputation: 103587

For SQL Server use: DBCC CHECKIDENT (Transact-SQL)

DBCC CHECKIDENT 
( 
        table_name
        [ , { NORESEED | { RESEED [ , new_reseed_value ] } } ]
)
[ WITH NO_INFOMSGS ]

example:

USE YourDatabase;
GO
DBCC CHECKIDENT (YourTable, RESEED, 300);
GO

Upvotes: 7

Related Questions