+ 1

Update part of data in column

How would I change data in column Email, for example; all hotmail.com addresses need updating to outlook.com, but leaving all characters before @ ? So John.Smith@hotmail.com will become John.Smith@outlook.com. UPDATE * from Users SET '%@outlook.com' Where Email LIKE '%hotmail.com'; Would this work?

28th May 2018, 11:24 AM
Marcel
Marcel - avatar
2 Respuestas
+ 3
No, it's not the right way to replace string. You should use Replace function. Try this- UPDATE * SET Email = REPLACE(Email, 'hotmail.com', 'outlook.com') WHERE Email like 'hotmail.com%'
28th May 2018, 11:36 AM
Sachin Artani
Sachin Artani - avatar
+ 1
That worked, thanks a lot :)
30th May 2018, 10:19 PM
Marcel
Marcel - avatar