I have a table that has some rogue tags that need replacing
The offending string ends <tr>
and needs replacing with </table>
Not all record are affected, so I need to find these and then replace them
Our skills using Update Replace Where are limited as the characters are not unique within the string but their position is, ie the last 4 characters
Have tried using
UPDATE table
SET field
REPLACE (RIGHT(field,4),</table>)
but suspec this is over simplified (and also fails)
Use the String. replace() method to replace the last character in a string, e.g. const replaced = str.
Remove characters from string using TRIM() TRIM() function is used to remove any character/ whitespace from the start/ end or both from a string.
try this:
UPDATE table
SET field=concat(left(field,length(field) -4),'</table>')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With