Welcome to WebmasterWorld Guest from 107.21.149.142

Forum Moderators: open

Message Too Old, No Replies

mysql column type for numeric values

     
12:00 pm on May 21, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 3, 2003
posts:961
votes: 0


Hello,

I have a mysql table which has a column which always uses a ten digit number. This number may be in the following formats: "0011223344" or "1122334400", etc

I used the varchar datatype earlier for this column but since the searches are done using this column, I decided to use either numeric or bigint for this column. But if I change it to bigint or numeric (10,2) - then it removes the starting 0's. For example: "0011223344" becomes "11223344".

However the search for "0011223344" or "11223344" provides the same results.

I would like to use the fastest column type to speed up searches and "0011223344" should display as "0011223344" within mysql.

12:09 pm on May 21, 2007 (gmt 0)

Junior Member

5+ Year Member

joined:May 18, 2007
posts:49
votes: 0


Hi,

You should choose column type as BIGINT and set its ATTRIBUTE to "UNSIGNED ZERO FILLED".

Hope, you will get the desired result.

12:15 pm on May 21, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 3, 2003
posts:961
votes: 0


Wow, IndiaMaster. That works perfect. thanks a ton :)