Import just certain colums of the table
| User, date | Message |
|---|---|
|
Written by x808sx
8 months ago Category: Import/Export 7 posts since Wed, 19 Sep 12 |
I have a datatable and i just want to update (not create new) the existing cells, there are 10 columns in the table, but i only want to import 3, is there a way to make it so that only the 3 columns are updated and the other 10 will be as they are? Ps. Great program |
|
Written by ansgar
8 months ago 3949 posts since Fri, 07 Apr 06 |
Where are you, in the query editor or in the "Import textfile" dialog? |
|
Written by x808sx
8 months ago 7 posts since Wed, 19 Sep 12 |
I have selected the database->selected the table i want to import to->Data Leaf then Tools->Import CSV-file. |
|
Written by ansgar
8 months ago 3949 posts since Fri, 07 Apr 06 |
Ah, so it is the import dialog. Well, you have to create an appropriate CSV file with your wanted columns, and then tell HeidiSQL via checkboxes which columns exist in that file. |
|
Written by x808sx
8 months ago 7 posts since Wed, 19 Sep 12 |
I did that but it cleared all the other fields also.
|
|
Written by jfalch
8 months ago 222 posts since Sat, 17 Oct 09 |
to be certain: how many columns (separated by |
|
Written by x808sx
8 months ago 7 posts since Wed, 19 Sep 12 |
3 columns. products_id, products_quantity, products_model |
|
Written by x808sx
8 months ago 7 posts since Wed, 19 Sep 12 |
It clears out the image/price etc. columns also |
|
Written by ansgar
8 months ago 3949 posts since Fri, 07 Apr 06 |
Yes, if you uncheck a column in that dialog, HeidiSQL does not include that one in the LOAD DATA command. I have a gutt feeling you are expecting an update of existing rows in your table, which no importer can do for you. The LOAD DATA command always creates new rows. |
|
Written by x808sx
8 months ago 7 posts since Wed, 19 Sep 12 |
yes i'm trying to update the existing tables, i guess i have to update the whole table in the same time? |
|
Written by jfalch
8 months ago 222 posts since Sat, 17 Oct 09 |
a simple solution would probably be: let what/whoever generates the above mentioned .csv file, generate an .sql file instead. Ie where you noww have a line of e.g. 9;5;XXX in your .csv file, instead generate a line containing UPDATE products SET products_quantity=5,products_model="XXX" WHERE products_id=9; when this has been done for all changes, load the generated .sql file into a heidisql query tab, and execute it there. |
|
Written by x808sx
8 months ago 7 posts since Wed, 19 Sep 12 |
Thanx for the help you guys, i got it working |
|
Please login to leave a reply, or register at first. |