Swap Tag for another SQL Tag

Asked

Viewed 21 times

1

I have the following email: [email protected], I need to change everything I have meusite.com.br for seusite.com.br.

How can I do?

My idea was: UPDATE tabela SET email = email "seusite.com.br".. But then it wouldn’t work, I’d just add.

  • 1

    depends on SGBD (which you did not mention). In MS Sql Server or example has the REPLACE command

  • I believe it would be the replace... maybe

2 answers

3

If it is SQL Server:

Update tabela
    set email = REPLACE(email, "meusite.com.br", "seusite.com.br")
Where email like '%meusite.com.br'

2


The following must be done:

UPDATE TABELA SET EMAIL = REPLACE(EMAIL,'meusite.com.br','seusite.com.br')
WHERE EMAIL like '%meusite.com.br'

Browser other questions tagged

You are not signed in. Login or sign up in order to post.