[英]SQL SERVER 2008 R2 find column words in another column
I have a table looks like: 我有一张桌子看起来像:
AV AVE
AVENUE AVE
AVEAPT AVE
APT #
First word to be found and replaced by second word. 找到第一个单词并替换为第二个单词。
I have to find these words in Address field in another table and replace all these? 我必须在另一个表的“地址”字段中找到这些单词并替换所有这些单词?
What is the best way to do it? 最好的方法是什么?
UPDATE a
SET Address = REPLACE(Address, r.Word, r.Replacement)
FROM AddressTable AS a
JOIN ReplaceTable AS r
ON a.Address LIKE '%' + r.Word + '%'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.