Jump to content

Recommended Posts

Hi all,

 

I have a CSV file that was given to me with 3 columns, one of which contains numbers in the "21,587" format.  I am trying to import this CSV into a MySQL database but since the file is a comma separated file, it is importing only number values before the comma.  21,587 becomes 21. 

 

Excel for some reason cannot search and delete the commas out of the cells, that was my first thought of what to do, although I'd rather keep the commas and use the field as a varchar rather than an int anyway.  Then I tried changing the "fields terminated by" option to something else, like "/r".  No dice.  Then I tried exporting the file as a text file and found that I could only import a CSV file or a SQL file anyway.

 

So, I'm stuck.  I would imagine this is something that has happened to people before, but despite all my searching, I have been unable to find a solution.

 

Any help would be truly appreciated!  Thanks!

Link to comment
https://forums.phpfreaks.com/topic/171948-csv-comma-issue-please-give-suggestions/
Share on other sites

Commas only exist in numbers to make them more human friendly. You will find in programming (mysql and php...) that you cannot even add numbers that contain things like $ signs and commas. You should store numbers as numbers and only add any human aids to them when they are displayed.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.