import csv file update only certain columns

bitseeker's profile image bitseeker posted 2 years ago in Import/Export Permalink

Hi,

when trying to import values of certain columns from a csv file into a already existing table to update them (no new rows - just update them), all other columns off the corresponding dataset are set to the default values.

One could think, that when selecting corresponding DB fields in the import dialog, only those get updated - cause what else would make sense in selecting those fields and change the order of the fields in the dialog box?

Please see screenshot to clarify what i mean.

thx Olli

1 attachment(s):
  • import-csvdata-certain-columns-only
BubikolRamios's profile image BubikolRamios posted 2 years ago Permalink

It does what it says = REPLACE (DUPLICTATES). Replaces something (all other fields but key fields) that matches the key. If you excluded those, default value pops in.

If there would be option UPDATE (DUPLICTATES), then it would work your way, without excluding fields.

ansgar's profile image ansgar posted 2 years ago Permalink

Exactly, the import only creates new rows. There is no LOAD DATA SQL command for updating rows, as far as I know.

bitseeker's profile image bitseeker posted 2 years ago Permalink

Thanks to both of you!

I thought it would work like "INSERT ... ON DUPLICATE KEY UPDATE" Statement, but yes it says "REPLACE" ;o)

But as long as there is not field mapping, this can´t work.

I didn´t have to use this for longer time and i thought i used heidi in the past to achieve this - but i guess it was mysqlfront by Nils Hoyer which had this feature - but unfortunatly his last version i have (5.4.144) is not running on my system anymore.

Did it manually now - like in good old times g

Please login to leave a reply, or register at first.