从列值中删除点和逗号

问题描述 投票:14回答:2

我正在使用SQL Server 2008

我从MySql迁移了一些数据;数据迁移成功,但是某些值包含带点和逗号的数据。

从我的数据中删除这些字符的最佳方法是什么?

sql-server database sql-server-2008
2个回答
19
投票

在SQL Server中,您可以使用REPLACE删除数据,并可以使用STUFF添加数据

如下

replace('Your String','charater you want to replace','with what')


stuff('Your String',position,count,'data') 

10
投票

在SQL SERVER中,您可以使用REPLACE

SELECT REPLACE(REPLACE('abc,123.456', ',', ''), '.', '')
© www.soinside.com 2019 - 2024. All rights reserved.