简体   繁体   English

SQL Server:如何用数字替换字符串中的空格(,ASCII)?

[英]SQL Server : How to replace whitespaces(&nbsp, ASCII) in a string with numbers?

This works select replace('string with space',' ','') and returns stringwithspace. 这适用于select replace('string with space',' ','')并返回stringwithspace。

This does not work select replace('8 190',' ','') , it returns 8 190 select replace('8 190',' ','')无效,返回8190

This is the same select replace('8 190',' ','') returns 8 190. 这与select replace('8 190',' ','')返回8190相同。

Why doesn't it work? 为什么不起作用?

string_pattern需要包含用于空格&nbsp的ASCII代码160

SELECT REPLACE('8 190', char(160),'')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM