Hi people! I am running MySQL 5.6.17-debug (Homebrew install) on Mac OS X 10.7.5. I am having a problem getting imported .CSV data to persist from session to session. No Google search seems to address this scenario!
I am importing .CSV data with the statement as follows:
USE myDB;
DROP TABLE tbl_1;
CREATE TABLE tbl_1 (
myType VARCHAR(10),
Month VARCHAR(2),
Day VARCHAR(2),
Year VARCHAR(4),
Description VARCHAR(360),
Amount NUMERIC(10,2),
Check_Slip VARCHAR(24)
);
LOAD DATA LOCAL INFILE '/Users/me/Downloads/file.CSV' INTO TABLE tbl_1 FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\
';
Then, I build a tblMain using the same instructions that I used to build tbl_1. Finally, I pull the data from tbl_1 into tblMain with:
USE myDB;
UPDATE tblMain
SET
tblMain.myType = tbl_1.myType
,tblMain.Month = tbl_1.Month
,tblMain.Day = tbl_1.Day
,tblMain.Year = tbl_1.Year
,tblMain.Description = tbl_1.Description
,tblMain.Amount = tbl_1.Amount
,tblMain.Check_Slip_Num = tbl_1.Check_Slip
WHERE 1 = 1;
I get the following error message:
“Error Code: 1630. FUNCTION tbl_1.column does not exist. Check the ‘Function Name Parsing and Resolution’ section in the Reference Manual”
I have tried different permutations of this method, but it seems like when I return to work on the db, it can’t find the columns (or the table itself!) of the original imported .CSV data.
- What mistake am I making?
- What is the ideal way to import .CSV data into MySQL?
Thanks in advance!