Create a 8 digit auto number

I have been told we need an 8 digit auto number given to each new record in our table
starting at 00000001.

Can this be done ?


Who is Participating?
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.

Faizan SarwarSoftware / Database DeveloperCommented:
not sure about starting from 00000001
but one option could be to set 8 digit
DBCC CHECKIDENT('YourTable', RESEED, 10000000)
Patrick MatthewsCommented:
Hello dark22,

Why do you need to store the leading zeroes in the database?  Why not let it be a simple int identity column,
and then format the result to be 8 digits in your queries/reports?


dark22Author Commented:
that maybe the way to go, I don't need to store it in the database,
What happens is a query is run in Access 2000 to import certain records from the first DB into an access table.

Can you make the access table format it to 8 digits ?
Patrick MatthewsCommented:
dark22 said:
>>Can you make the access table format it to 8 digits ?

The same issue applies: you could build the import process to do this, but why bother?
dark22Author Commented:
Ok then from that point it is exported to CSV file and then imported into an accounts program.

It is the accounts program that requires an 8 digit account number for the record being imported.

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
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

From novice to tech pro — start learning today.