MySQL CSV importing error: Invalid column count - mysql

I get an invalid column count error while trying to import from a ; delimited CSV to MySQL via phpMyadmin. The error is possibly caused by the ; signs in the HTML text such as é. What should I do?

The records contained <pre> texts in coding-related articles, so I had to remove [CR] and [LF] chars (they were interpreted as new lines => new record), plus I had to replace ; in html entities with something else, so now column count matches and the import was successful. Converting back the replace text to ; everything works now.

Related

Error Code: 1300. Invalid utf8mb4 character string

I have created a table from a csv file using built in mysql workbench wizard.
The structure was created and also 3 test rows were imported into the table.
Now I wanted to use the very same csv which i used to create the table in the first place and load the same 3 rows once again but using the LOAD DATA INFILE command.
I am getting error code: 1300. The string field contains german ü characters which I assume are the problem but why ? The column already contains string values with those characters.
screenshot

Why aren't my functions working as expected in MySQL?

I am trying to figure out why MYSQL isn't working as expected.
I imported my data from a CSV into a table called Products, which is shown in the screenshot. It's a small table of just ID and Name.
But when I run the where clause, finding out where the Name = 'SMS', it returns nothing? I don't understand what the issue is.
My CSV contents in Notepad++ is shown below:
This is what I used to load in my CSV, if there are any errors here.
Could you share your csv file content?
It's happened to me too before, and the problem is because there's some blank space in the data in csv file.
So maybe you could parse first your csv file data (remove the "not needed" blank space) before import it to database
This is often caused by spaces or look-alike characters. If caused by spaces or invisible characters at the beginning/end, you can try:
where name like '%SMS%'
You can then make this more general:
where name like '%S%M%S%'
When you get a match, you'll need to do more investigate to find the actual cause.

Error code: Inavlid in Loading Data on BigQuery

I have a large CSV file (nearly 10,000 rows) and I am trying to upload it on the BigQuery but it gives me this error:
ile-00000000: CSV table references column position 8, but line starting at position:622 contains only 8 columns. (error code: invalid)
Can anyone please tell me a possible to reason to it? I have double checked my Schema and it looks alright.
Thanks
I had this same issue when trying to import a large data set in a csv to a BigQuery table.
The issue turned out to be some ascii control characters (\b, \t, \r, \n) in the data that was written in the csv. When the csv was being sent to BigQuery these characters caused the BiqQuery csv parser to misinterpret the line and break because the data didn't match with the number of columns in the header.
Replacing these characters with a space (to preserve formatting as best as possible) allowed me to import the data without further issues.
The error message suggests that the load job failed because at least one row has fewer columns than the automatically detected schema dictates.
Add
allow_jagged_rows=true
in the options.

SSIS - csv import

I have a file of 700 000 rows and 90 columns and I had converted it to csv to upload it (using qualifier: "). The import worked but when I look at the table in SQL I see few text has moved to the next column.
In the actual file there is column called Comments and it has all type of characters(like *,|,| etc). Can this be the reason?
I tried doing the same import from .xlsb but it throws an error:
Failed to start
project(Microsoft.DataTransformationServices.VsIntegration)
If your fields have the same characters s the separator then of course the whole thing will break.
If you create the CSV with , as the separator and quotes (") around the fields, you should be able to handle it in SSIS using these instructions by adding " as the text qualifier.
I haven't tested this myself, but I would assume it works just fine.

Cannot import csv into mysql database using phpmyadmin wizard

I am trying to import a csv file into my mysql database using phpmyadmin but keep getting errors.
Here is how the csv looks:
Then I import like this:
And get the error: "Invalid parameter for CSV import: Fields enclosed by". I have tried to put the columns in quotes " or put a semicolon after each column, but keep getting errors.
Yeah, you have an extra field in there. For instance, with your example line of:
itemId,date,description,amount
,1,2/13/2013,Fabrics,44
the date maps to "description" because of the leading comma, which basically gives an empty (or null, depending on how the import is handled) value to itemId, which doesn't seem to be what you want. Where'd that extra comma come from -- was this an export from some program?
Also, in this case you don't have anything enclosing the fields so you should just be able to leave that value empty, which seems to have worked for you once you got the column count corrected.
I had to remove the first line of the csv (containing the column names) and that solved the issue. Everything got imported properly.
Note, the date field needed reformatting to match SQL's date format yyyy-mm-dd.