question about replace function is SQL

siamandm
5StarLounger
Posts: 1192
Joined: 01 May 2016, 09:58

question about replace function is SQL

Post by siamandm »

Hello All,
if i have a column for emails, and if i want to replace all gmail.com and yahoo.com to outlook.com in one syntax

Replace(email,'gmail.com' OR ' yahoo.com', ' outlook.com') didn't work.

your help is much appreciated.
Regards

User avatar
HansV
Administrator
Posts: 78236
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: question about replace function is SQL

Post by HansV »

Use two nested Replace functions:

Replace(Replace(email, 'gmail.com', 'outlook.com'), 'yahoo.com', 'outlook.com')
Best wishes,
Hans

siamandm
5StarLounger
Posts: 1192
Joined: 01 May 2016, 09:58

Re: question about replace function is SQL

Post by siamandm »

thank you very much dear Hans, as usual working great.