List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:February 9 2003 6:23pm
Subject:Re: Help with default NULL
View as plain text  
At 12:32 -0500 2/7/03, Bhavin Vyas wrote:
>I have a table Log described as such:
>| Field    | Type      | Null | Key | Default | Extra |
>| rec      | int(1)    | YES  |     | NULL    |       |
>| time     | int(10)   |      |     | 0       |       |
>| ct       | char(100) | YES  |     | NULL    |       |
>Notice that default for ct is NULL.
>Now I have a ^ separated line in my file which I am loading via LOAD FILE.
>This line MAY or MAY NOT have the corresponding ct value. So,
>it could either be ....^^(ct value)  or .....^^.....(no ct
>I would like that when there is no ct value present in the line,
>the ct value in Log table should stay as the default NULL....but it is not.
>The value becomes '' i.e. a zero length string.
>Any ideas on how can I keep it as NULL?

You can't "keep it" as NULL, because an empty string *isn't* NULL.
It's an empty string, and MySQL is loading it correctly.

If you want it to load NULL, change those empty strings to \N (backslash
capital-N).  MySQL will interpret that sequence as NULLL and load 
NULL into your

For more information, see the manual:

>Any help is much appreciated.
>Thanks in advance,
>sql, mysql, query.

converting MS SQL to MySQLHawk6 Feb
  • RE: converting MS SQL to MySQLCal Evans7 Feb
  • Help with default NULLBhavin Vyas7 Feb
    • Re: Help with default NULLPaul DuBois9 Feb
  • Re: converting MS SQL to MySQLInsanely Great7 Feb
  • Re: converting MS SQL to MySQLBob Hall8 Feb
RE: converting MS SQL to MySQLHawk7 Feb
Re: converting MS SQL to MySQLmysql-list-bot8 Feb
RE: Help with default NULLVictor Pendleton10 Feb
Re: Help with default NULLkeith.jones10 Feb