Welcome Guest, Not a member yet? Register   Sign In
certain csv fields to mysql
#1

[eluser]trinic[/eluser]
I have a csv (dump from mssql) that I would like to put in to a mysql table. The only catch is I would like to be able to format it with code because the tables do not match up perfectly. For example if my csv was:

first name, last name, address, city, state, other

and I only wanted to add first name, last name and other

How would I go about this?
#2

[eluser]johnpeace[/eluser]
I would go about it using Sequel Pro's (my OS X MySQL client) excellent CSV import feature.

If it has to be done repeatedly as part of the app, you'll probably need to write a script that will loop through each row and parse each cell into the correct field in your table. I'm sure countless examples of how to do that can be found online.




Theme © iAndrew 2016 - Forum software by © MyBB