How do I replace a substring of a string before a specific character?

前端 未结 4 1145
無奈伤痛
無奈伤痛 2021-01-02 19:50

Table Email:

Values:

josh@yahoo.com
carmine32@hotmail.com
zehmaneh@yahoo.com

I want to replace the string before

4条回答
  •  有刺的猬
    2021-01-02 20:33

    You can use SUBSTRING and CHARINDEX:

    UPDATE Email set email = 
        'test' + SUBSTRING(email, CHARINDEX('@',email), LEN(email))
    

    Fiddle: http://sqlfiddle.com/#!3/0face/6/0

提交回复
热议问题