简体   繁体   English

SQL SERVER 2008 R2在另一列中查找列词

[英]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.

相关问题 SQL Server 2008 R2:查找column1中存在column2值的行 - SQL Server 2008 R2: Find rows where column2 value present in column1 将一列的三个值求和并将其插入SQL Server 2008 R2中的另一列 - Summing three values of one column and inserting it in another column in SQL Server 2008 R2 SQL Server 2008 R2,为另一列的每个不同值选择一个列的一个值 - SQL server 2008 R2, select one value of a column for each distinct value of another column 如何在SQL Server 2008 R2中添加具有其他列值作为默认值的列? - How to add a column which has another column value as default value in SQL Server 2008 R2? 通过另一个表中的列更新SQL Server 2008 R2中的表,并且还需要求和值 - Update a table in SQL Server 2008 R2 by a column in another table and also need a sum value 连接两个Float列,并将它们插入到SQL Server 2008 R2中的另一个Float列中 - Concatenating two Float columns and insert them to another Float column in SQL Server 2008 R2 在使用SQL Server 2008 R2查询时如何使用其他列替换提取的值 - How to replace fetched values with another column while querying with SQL Server 2008 R2 根据两个列值是否出现在SQL Server 2008 R2的另一个表中来更新表 - Update a table based on if two column values appear in another table on SQL Server 2008 R2 将一列从一个表复制到SQL Server 2008 R2中的另一个表 - Copy a column from a table to another table in SQL Server 2008 R2 根据另一列的最大值选择一个不同的行SQL Server 2008 R2 - Select a distinct row based on the max value of another column SQL Server 2008 R2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM