如题,ms sql 2008 Replace 同字段替换2个符合条件为空如何写
比如数据
数据
123-456.789
147-2833.13
17-273.2378
结果
123456789
147283313
172732378
如何替换呢
------解决方案--------------------
- SQL code
replace(replace(Col,'.',''),'-','')
------解决方案--------------------
replace(replace(col,'-',''),'.','')
------解决方案--------------------
- SQL code
use Tempdbgo--> --> if not object_id(N'Tempdb..#T') is null drop table #TGoCreate table #T([数据] nvarchar(11))Insert #Tselect N'123-456.789' union allselect N'147-2833.13' union allselect N'17-273.2378'GoSelect replace(replace([数据],'.',''),'-','')from #T/*123456789147283313172732378*/
------解决方案--------------------
- SQL code
select replace(replace(数据,'.',''),'-','')