替换SQL Server中的某些字符串
我使用SQLServer2008R2 因为在SQL Server中执行正则表达式并不是那么容易,所以我需要一些关于如何解决这个问题的建议 我有一列包含以下类型的数据:替换SQL Server中的某些字符串,sql,replace,sql-server-2008-r2,Sql,Replace,Sql Server 2008 R2,我使用SQLServer2008R2 因为在SQL Server中执行正则表达式并不是那么容易,所以我需要一些关于如何解决这个问题的建议 我有一列包含以下类型的数据: id Ville ------------------ 1 Saint azeraze 2 Saint ooiqsdf 3 Saint fefeee 我想将Saint替换为St,以获得此结果: id Ville --------------- 1 St azeraze 2 St ooiqsd
id Ville
------------------
1 Saint azeraze
2 Saint ooiqsdf
3 Saint fefeee
我想将Saint
替换为St
,以获得此结果:
id Ville
---------------
1 St azeraze
2 St ooiqsdf
3 St fefeee
如何使用替换
UPDATE TheTable
SET Ville = REPLACE(Ville, '????', '????')
WHERE Ville LIKE 'Saint%'
我想没问题,你在这方面有什么错误吗?
UPDATE TheTable
SET Ville = REPLACE(Ville, 'Saint ', 'St ')
WHERE Ville LIKE 'Saint %'