Need to export SQL only some columns, and UPDATE statement

[expired user #10725]'s profile image [expired user #10725] posted 7 years ago in General Permalink

Hi there!

Newbie here, and using HeidiSQL since 1 month. I have some problems exporting a SQL file with a specific columns, it's possible to select only 2 columns exporting a table?.

Also, i want to gerenate a SQL file with UPDATE statement, as a picture, see it and tell me please.

Any question please ask me.

Thanks all.

2 attachment(s):
  • Captura
  • Captura2
ansgar's profile image ansgar posted 7 years ago Permalink

Columns cannot be restricted in "Table tools" > "SQL export".

But you could do that in the grid export dialog on a query tab. Fire your custom SQL query with the column(s) you want to export, then run it. Then, on the result grid, rightclick and click "Export grid rows".

I don't understand your "UPDATEs as a picture" question.

[expired user #10725]'s profile image [expired user #10725] posted 7 years ago Permalink

Hey, tnx for the help.

I do this query : "select entry,content_loc6 from creature_ai_texts;"

then i export grid rows works as expected.

Second question, when i import that SQL file, it erases all columns except exported ones ¿How i can solve it?

Would be perfect generate the SQL export as this query, that works like a charm for my pruporse:

UPDATE creature_ai_texts SET entry='-1', content_loc6='Parece que esos idiotas de la Abadía nos han enviado carne fresca.' WHERE (entry='-1');

Thanks again

ansgar's profile image ansgar posted 7 years ago Permalink

Second question, when i import that SQL file, it erases all columns except exported ones ¿How i can solve it?

No, it probably erases rows, not columns. That's an important difference. Which SQL format did you select for the export? There are 3 different ones. There is no UPDATE export, but I guess the REPLACE option suits your needs.

[expired user #10725]'s profile image [expired user #10725] posted 7 years ago Permalink

Al the three options erases rows :-|

ansgar's profile image ansgar posted 7 years ago Permalink

No, INSERTs throw errors without deleting rows. However, there is no UPDATE mode.

[expired user #10725]'s profile image [expired user #10725] posted 7 years ago Permalink

Would be nice to add that feature, there is not program in all internet that have that feature.

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