Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Reset Indentity

Author  Topic 

mahesh_bote
Constraint Violating Yak Guru

298 Posts

Posted - 2007-07-26 : 03:44:33
Hi All,

I have one table with Identity column. I wants to reset the identity value from 1 as I have deleted all the records from that table.

Can anybody tell me, how to reset the Indetity column?

Thanks in advance,

Mahesh

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-07-26 : 04:23:36
DBCC CHECKIDENT (YourTableName');


_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-07-26 : 06:21:54
Or perhaps to force a specific initial value you may need:

DBCC CHECKIDENT ('YourTableName', RESEED, 1)

Kristen
Go to Top of Page

mahesh_bote
Constraint Violating Yak Guru

298 Posts

Posted - 2007-07-26 : 06:53:02
quote:
Originally posted by Kristen

Or perhaps to force a specific initial value you may need:

DBCC CHECKIDENT ('YourTableName', RESEED, 1)

Kristen



Its better !!!

Mahesh
Go to Top of Page

LoztInSpace
Aged Yak Warrior

940 Posts

Posted - 2007-07-26 : 19:31:49
Out of interest, why do you care what values are in your identity?
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-07-27 : 01:48:50
When we move new stuff from DEV to Production we reset the IDENTITY value. Just for tidiness sake ...

Kristen
Go to Top of Page
   

- Advertisement -