The following problem was driving me nuts and i was trying to work through my code to solve the error. Here's my category table:
#Create Category table with appropriate information.
CREATE TABLE category (
catID VARCHAR(20) NOT NULL,
subcatID VARCHAR(20) NOT NULL,
catname VARCHAR(255),
subcatname VARCHAR(255),
numb INT(11),
subcatcomment VARCHAR(255),
catbanner VARCHAR(5),
catdescription VARCHAR(255),
PRIMARY KEY (catID, subcatID)
) ENGINE=INNODB;
I have an Excel file that has like 85 rows of categories. For each and every empty field, in Excel, I put a \N, which represents NULL. Then after I save this file as a tab delimited text file, i import it into the database from the MySQL command line client using the "load data infile" command.
What is crazy is that ALL fields that have \N do show up as null, EXCEPT the last column/attribute (catdescription). When imported, the data in that particular column shows up as a capital N!
Again, the other columns that have \N in many of the fields are basic VARCHAR type columns. And the \N loads correctly. But the \N in the catdescription column is not loading \N, but rather it is ignoring the \ and simply loading N.
What the heck is up with that? 😕
And if it helps in the troubleshooting, i can also tell you something else weird about this column. My fields are OPTIONALLY enclosed with " marks, and considering that this file is TAB delimited, commas within a field should be fine. This is ALWAYS the case on ALL my other tab-delimited text files, where i include commas in the text on some fields, as needed gramatically, and they all import file.
But for this particular column? Nope. I get an error. Again, this error is not as much bothering me, although there must be some logical explanation for it. I'm simply mentioning it in case it helps someone diagnose the MORE IMPORTANT error i'm having...the crazy \N importing as simply N.
Thanks.
Jonathan