Using a wildcard in UPDATE REPLACE query

I have a ton of rows in the database that, in the entry column, are similar to this:

“Set to bouncing due to a hard bounce from exampleEmailAddress@yahoo.com.”

I am trying to remove the email address so that the column just looks like this:

“Set to bouncing due to a hard bounce.”

What do I put in where the question marks are to make this query work?

UPDATE notesOnline SET entry = REPLACE(entry,‘???’,‘Set to bouncing due to a hard bounce.’) WHERE entry LIKE ‘Set to bouncing due to a hard bounce%’;

Thanks!

Why not just follow the KISS method?

UPDATE notesOnline
   SET entry = ‘Set to bouncing due to a hard bounce.’
 WHERE entry LIKE ‘Set to bouncing due to a hard bounce%’;

Or not add the email address to the entry field in the first place?

If the entry field has more text than that, you might be able to use regular expressions depending on the DBMS you’re using.

1 Like

Thank you! Why didn’t I think of that? LOL

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.