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 2000 Forums
 Transact-SQL (2000)
 Change Identity Seed with TSQL

Author  Topic 

iamlerxt
Starting Member

11 Posts

Posted - 2004-11-01 : 14:59:53
I have tried and tried to get ALTER TABLE and/or ALTER COLUMN to reset the Identity Seed of my primary key column. It either can't be done with TSQL or I am not formatting the SQL properly. (I suspect that it is the latter).

I simply want to change the Identity seed in several tables without having to go in at every site and change them in enterprise manager design view.

Thanks in advance for any help.

ehorn
Master Smack Fu Yak Hacker

1632 Posts

Posted - 2004-11-01 : 15:12:33
[code]USE <thedb>
GO
DBCC CHECKIDENT (<field>, RESEED, <new #>)
GO

[/code]
Go to Top of Page

iamlerxt
Starting Member

11 Posts

Posted - 2004-11-01 : 16:29:03
Wonderful!!! Thank you so much.
Go to Top of Page
   

- Advertisement -