我希望更新特定列的多个字符串中的单词。
例如;
Update Column A = 'This is a line of text.'
To 'This is a string of text.'
其中列A可能在数据库中出现多次。显然我可以说;
Update
TABLE
Set
A = 'This is a string of text.'
Where
A = 'This is a line of text.'
但是我很好奇有一种更好的方式,也许正在使用正则表达式?有些东西;
Update
TABLE
Set
A = [First Part of A] + 'string' + [Second Part of A]
Where
A = 'This is a line of text.'
答案 0 :(得分:2)
使用此:
A = REPLACE(A, 'string', 'line') WHERE A LIKE '%line%'