Link to home
Start Free TrialLog in
Avatar of LTY83
LTY83

asked on

How do I set a start auto number for a sql server table

I have a table that has a n INT column that is used as a unique id, i was curious how I could have that column start at a number like 300,000 for example instead of defaulting to 1 when there is no data in teh table?


Thanks!

Loren
Avatar of Aneesh
Aneesh
Flag of Canada image

DBCC CHECKIDENT (urColumn, RESEED, 300000)
Avatar of LTY83
LTY83

ASKER

should I run that in query analyzer?
yes
Avatar of LTY83

ASKER

what would the full statement look like? DBCC CHECKIDENT(mytable.mycolumn, RESEED, 300000) ?
ASKER CERTIFIED SOLUTION
Avatar of Aneesh
Aneesh
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of LTY83

ASKER

ahh i see, thanks!
sorry for my first mistake.. Its 11.44 pm here .. need a good sleep :)
just 1 note (points for aneeshattingal):
when you create the table, you can specify the identity seed:

create table mytable ( identity_field int identity(300000, 1), <other fields> )