Welcome to WebmasterWorld Guest from 54.234.8.146

Forum Moderators: open

Message Too Old, No Replies

mysql column type for numeric values

     

Imaster

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

WebmasterWorld Senior Member 10+ Year Member



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.

IndiaMaster

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

5+ Year Member



Hi,

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

Hope, you will get the desired result.

Imaster

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

WebmasterWorld Senior Member 10+ Year Member



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

Featured Threads

Hot Threads This Week

Hot Threads This Month