sashi34u Posted February 6, 2009 Share Posted February 6, 2009 Hi all, My MySQL version is 5.0.51b I am trying to upload a CSV file using the LOAD DATA INFILE command. The data is getting uploaded, but when I see the data, in the First column 1) Some of the rows have their first letter missing 2)Some of the rows have 2 or more than two letters missing 3) only one row has the full name without missing any thing This is the Code I am using: LOAD DATA INFILE 'C:/Users/Sashikanth/desktop/buildings.csv' INTO TABLE sashi4 FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '/n' (BN, BC); Can anyone please tell me as to what the reason could be?? Thanks, Sashi Quote Link to comment Share on other sites More sharing options...
fenway Posted February 6, 2009 Share Posted February 6, 2009 Post a few lines from the .csv file. Quote Link to comment Share on other sites More sharing options...
sashi34u Posted February 6, 2009 Author Share Posted February 6, 2009 These are some of the lines in the original .csv file Burruss Hall 176 Squires Student Center 180 Student Services Building 192 Torgersen Hall 174 University Bookstore 178 Whittemore Hall 134 Williams Hall 152 Smyth Hall 105 The First part is the building name and the later integer part is the building code. Quote Link to comment Share on other sites More sharing options...
aschk Posted February 6, 2009 Share Posted February 6, 2009 "... TERMINATED BY '/n' ..." - isn't a valid line terminator, I think perhaps you mean '\n' ? Or even '\r\n' depending on which operating system the CSV was produced in. Quote Link to comment Share on other sites More sharing options...
sashi34u Posted February 6, 2009 Author Share Posted February 6, 2009 Sorry about the confusion. I was actually using '\n'. I just mis typed it in the query box. I am using the Vista operating system, and the file I have used was excel file in the MS_WORD 2007 format. I have saved it as .csv file and used it to upload the data. Forgot to mention one more thing. When I said that 1) Some of the rows have their first letter missing 2)Some of the rows have 2 or more than two letters missing 3) only one row has the full name without missing any thing I was using a .txt file, with a comma between the first column and second column, the 3rd row from the bottom goes in correctly. This particular row has a building code which is not entirely numeric. It has an alphabet in the building code. I do not know if that is causing some issue. I was trying different combinations in .csv and .txt and got mixed up. Sorry about that. Quote Link to comment Share on other sites More sharing options...
fenway Posted February 8, 2009 Share Posted February 8, 2009 where are the commas Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.