finding & replacing

[expired user #6753]'s profile image [expired user #6753] posted 11 years ago in General Permalink
Hi there

Just wondering how I would use Heidi to find multiple uses of a particular word in Data view and replace it with another word without having to manually do each one....

Many thanks

Jamie
ansgar's profile image ansgar posted 11 years ago Permalink
Normally, you would write an UPDATE query in a "Query tab".

But I'm currently working on issue #2979. When this is done, you can hit Ctrl+R for a "Search + Replace" dialog (or Ctrl+F for "Find" mode), and replace specific text in rows. This replacement is done on the rows you have either in the "Data" tab, or in a editable query result from one table. You can even apply regular expressions with callbacks there, make the search case insensitive and so on.
[expired user #6753]'s profile image [expired user #6753] posted 11 years ago Permalink
Sorry anse, I am really really new to all this so I dont know how to write or what to write in a query tab....

when do you think #2979 will be done?
ansgar's profile image ansgar posted 11 years ago Permalink
Will take some more days.

However, you should definitly make yourself familiar with some SQL stuff if you use HeidiSQL. The more you know about SQL, the less critical is it to click "somewhere".

The "Query" tab is the rightmost one of the main tabs. Click on it, write some SQL code into the editor and press F9 or the blue arrow button to execute it.

Look at the following query:
UPDATE mytable SET mycolumn1=REPLACE(mycolumn1, 'from_str', 'to_str')

This would modify all rows with a "from_str" literal in mycolumn1, replacing it with "to_str".

Be careful, this applies to the whole table, so this is very powerful and probably executed within a few milliseconds after having pressed F9.
[expired user #6753]'s profile image [expired user #6753] posted 11 years ago Permalink
thanks anse

thats a real help :D

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