change auto increment number sql server 2005

hi ,
i have a table that i want tht PK will start from 100
how can i do it ?

thanks ...
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Om PrakashCommented:
Declare column and start with 100
id_num int IDENTITY(100,1)

Tech_MenAuthor Commented:
the table is alerady exsist
Om PrakashCommented:
Create table testTable (id_num int primary key IDENTITY(100,1), username varchar(100))
insert into testTable values ('user1')
select * from testTable -- will have id_num as 100

Open in new window

Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

Tech_MenAuthor Commented:
no no the table is in the db i just need to reset the PK he is in num 40 i want to change it to 100
If the table already exists,

dbcc checkident(tablename, reseed,100)

will start from 100.
Tech_MenAuthor Commented:
i deleted all the rows from it and i want the firsr row will start in 100
Tech_MenAuthor Commented:
i try it :
dbcc checkident(dbo.Orders, reseed,100)
not working :
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '.'.

Om PrakashCommented:
If the table is already present then
Create a new column with identity & drop the existing column

alter table testTable add id_num2 int primary key IDENTITY(100,1)
select * from testTable -- will have additional column


and update table by changing the ident column value to new value
Tech_MenAuthor Commented:
i dont want to add new col
Om PrakashCommented:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Tech_MenAuthor Commented:
i try this :
(dbo.Orders, reseed,100)
not working :
Incorrect syntax near the keyword 'IDENTITY'
Tech_MenAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.