Reset Identity Seed Value – SQL Server 2005

8 01 2009

Not really SharePoint related but something that really saved my bacon today!

If you are using an identity column for a number in SQL Server and need to change the current value – e.g.start the next identity seed at 500 rather you can use the following commands:

To check what the current identity value is:

DBCC CHECKIDENT (‘tablename’, NORESEED)

To set the valueof the next ID/Identity value, use this command (where value is the number you want):

DBCC CHECKIDENT (‘tablename’, RESEED, ‘value’)

Hope this helps some people.

Advertisements

Actions

Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: