List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:February 15 2003 11:07pm
Subject:Re: conditional default value
View as plain text  
At 14:00 -0900 2/15/03, Tim Johnson wrote:
>Hello All:
>     (using MYSQL Ver 11.15 Distrib 3.23.41
>      for redhat-linux-gnu (i386) (RH 7.2))
>I am importing text data (but in a numeric format).
>   The customers wants 'N/A' in an empty field.
>   The customer wishes that if a field = '9999'
>     the default value of 'N/A' be substituted.
>Is this possible to do in MySQL?

Sure, but not with LOAD DATA.  You can either preprocess the data file
beforehand, or do this after import:

UPDATE TABLE t SET col = 'N/A' IF col = '' OR col = '9999';

>   Documentation?
>Tim Johnson <tim@stripped>

conditional default valueTim Johnson15 Feb
  • Re: conditional default valuePaul DuBois16 Feb
  • Re: conditional default valueStefan Hinz16 Feb