Optimal mysql field type

Hi all,
I have a table where I need to control my id numbers by my self... no need for autoincrement.

My problem is, that some of the ID numbers HAVE TO start with a zero.. Example: 01099304
I can not use int for the fieldtype, cause that will set the value to 1099304, and varchar would make the database slow... Is there a more optimal fieldtype for this???

Best regards,
Peter
CrapmanAsked:
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.

nurbekCommented:
try datatype as numeric
0
CrapmanAuthor Commented:
Enum?
0
eyeh8uCommented:
Numeric is just string storage of floating point data types, it will solve leading 0's but is probably not the best solution.

Try using the ZEROFILL Option:

http://dev.mysql.com/doc/mysql/en/Numeric_types.html

INT(8) ZEROFILL

For example, if you stored 1099304 it would be returned as 01099304 while being stored in the optimal integer data type.
0

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
nurbekCommented:
sorry i was in ms sql
i dont know it numeric field datatype in mysql :(
also
Example: 01099304 (It is logically number)
but when you use it only uses 1099304 removes the 0

If you are planning to print it out as 0001099304 (if you have standart length in all)
write a function that returns as string
you can get the lenght of number and add the zeros before number and return function

0
CrapmanAuthor Commented:
Wohoo, eyeh8u's solution worked perfectly!! :)

Thanks to both of you for your support...
0
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
ASP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.