List:General Discussion« Previous MessageNext Message »
From:Fred G Date:August 5 2012 3:14am
Subject:DECIMAL datatype automatically makes blank become 0
View as plain text  
Hi--

I'm using MySQL 5.2 Workbench, and when I import a csv into MySQL, blank
values become 0 when I define the datatype to be a DECIMAL (in our case
(DECIMAL(12,2)). Since there is the potential for values to be 0, this
poses a problem for us. I initially wanted to make all the DECIMAL values
become VARCHAR(255), because I can still do inequality queries on this
column if it is a VARCHAR, and VARCHAR does not mind blanks. It keeps them
as is.

But I'm sure that I must be missing something here. Is there a way to use a
DECIMAL-like operator that treats blanks as blanks? If not, is there a
better strategy then making the relevant column a VARCHAR?

Much thanks!

Thread
DECIMAL datatype automatically makes blank become 0Fred G5 Aug
  • Re: DECIMAL datatype automatically makes blank become 0hsv7 Aug
Re: DECIMAL datatype automatically makes blank become 0Fred G6 Aug
  • RE: DECIMAL datatype automatically makes blank become 0Benjamin Stillman6 Aug
    • RE: DECIMAL datatype automatically makes blank become 0Benjamin Stillman6 Aug
      • Re: DECIMAL datatype automatically makes blank become 0Fred G6 Aug