Good afternoon. I am trying to import a csv file to a SQL database hosted through GoDaddy. However, I continue to receive an error which states "Line 7 has 24 values (20 expected)". Line 7 in my .csv file only has 20 columns (20 values) and no matter what I try I cannot get my data to import. I have tried removing line 7 from my .csv file altogether, but then the error says a different line has 24 values and only 20 are expected. I have tried removing countless lines of records to see if I can get rid of this error message to no avail. Obviously, there is a deeper problem here. Does anyone have any suggestions as to what my problem(s) might be? I am not extremely familiar with Databases. While I did take a course or two in college in database development we worked with Oracle and the DB was hosted on the school servers. Thus, I am not very familiar at all in my current DB environment. Any help, suggestions, or ideas would be greatly appreciated. Thanks in advance.

Make sure that line 7 (and all lines for that matter) in your csv don't have more than 19 commas. That will give you 20 values in a csv file. This line in a csv file:

1,,2,,3

actually has 5 values, it's just that 2 of the values are null/blank.

Make sure that line 7 (and all lines for that matter) in your csv don't have more than 19 commas. That will give you 20 values in a csv file. This line in a csv file:

1,,2,,3

actually has 5 values, it's just that 2 of the values are null/blank.

Darkagn, thank you for the information. That was my problem exactly, In my spreadsheet, I had several commas throughout which created the error. I was able to remove all of the 'extra' and unnecessary commas and now I was able to get half of my records to upload. I am receiving another error message for the other half of the records, but hopefully I can figure that out tomorrow. Thanks again, your help was greatly appreciated, solved my issue, and save me some additional headaches.

Jobojo;
You may mark this thread as SOLVED if your issue is sorted out.

Thanks.

i am importing csv file in sql db table using c# code, csv file split with semicolon(;).
when data is import in table then all data is fill in only first two columns and other columns show null. how can solve this problem...**.help me **

Member Avatar for iamthwee

Your csv file isn't a csv file, it's separated with semicolons.

Maybe do a quick search and replace and swap all the semicolons for commas, but you have to be very very careful with this approach.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.