* Eben Goodman > I am storing book isbn numbers in a table. isbn numbers are 10 digit > numbers and many start with 0. The data type of the field I am storing > this info in is a bigint(16) unsigned.
Why not use "BIGINT(10) UNSIGNED ZEROFILL"? > It appears that isbns that start > with 0 are going in as 9 digit numbers, the 0 is being ignored or > stripped. I have experienced this before with integer data types > ignoring leading 0s. I'm wondering how to address this? Should I > change the field to a varchar or char data type? Integers are numeric values, they don't have leading zeroes, but a _presentation_ of a number might have leading zeroes. Defining the field with ZEROFILL tells the mysql server to allways use leading zeroes on when _presenting_ this column. The actual integer is stored in a binary format, the same way as if you did not use ZEROFILL. You could of course change your column type to a string type, but you don't need to, unless "0123123123" and "123123123" are two different, valid ISBN numbers. If you can accept that "123123123" _is_ "0123123123" without the leading zero, go for ZEROFILL. It is faster to search on an indexed BIGINT compared to an indexed VARCHAR(10). <URL: http://www.mysql.com/doc/en/Column_types.html > ...and don't worry about leading zeroes in your SQL queries, input the ISBN number as a number, without quotes or leading zeroes. -- Roger -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]