Monday, March 26, 2012

Reset tables

I

use Microsoft SQL Server and also I have several tables. One table has

ID like PK, and name. ID use autoincrement number mode, and now when I

want start form one but not from 156 or like that. I don't know how?

And also when I delete all data from table an run my apllication and

add something in table, it starts form last number, not from one.

Maybe can I do it from SQL menagement studio?

How I can reset table and start from 1?Make sure the table is empty or else this won't work. Go to SQL management studio. Go to modify table. Select the identity column. Look in the column properties window under identity specification. There you see the Identitiy Seed. Change the value (for instance to 2) and save it. Change it back to 1 and save is again. This should do the trick.|||Hi,

have a look in the BOL for the following command:

DBCC CHECKIDENT ('HumanResources.Employee', RESEED, 30)

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de

No comments:

Post a Comment