Re: FN-FORUM: Storing the leading 0 of product codes in MySQL
date posted 11th October 2006 11:31
On 11 Oct 2006 09:57:32 -0000, D D Glendinning [EMAIL REMOVED] wrote:
>
> Morning all again,
>
> Right, I am storing products codes, split into two fields, one for
> characters, and one for digits.. The problem is that I need 01 stored
> as 01 and not as 1, and sadly I can't store it in the characters
> field... so is there a field type that preservers the 0?
>
Is there a reason to store it as a number? If you're not performing
mathematics on it then it's best practice to store it as text (at
least that's what I was told). So for example phone numbers should
always be stored as text. Text uses less memory than numbers. Also
why the 2 fields for product codes? I guess you have your reasons but
it seems odd.
Paul