删除字符串sql server中的所有空格
我正在尝试将这个“232431 K”转换为这个“232431K”,但我找不到执行此操作的函数。我找到的所有参考文献都是 TRIM、RTRIM 和 LTRIM,但在这种情况下这些函数对我来说没有用,因为我没有要删除的左侧或右侧空格,空格位于字符串“内部”。
I'm trying to convert this '232431 K' into this '232431K' and I can't find a function that does this. All the references I have found are TRIM, RTRIM and LTRIM but these functions are not useful for me in this case because I don't have left or right white spaces to be removed, the white spaces are "inside" the string.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以参考在SQL Server中删除字符串中的所有空格< /a>.
简单来说,您需要使用
REPLACE
函数,例如REPLACE(stringValue, ' ', '')
You can refer to Remove all spaces from a string in SQL Server.
In simple terms, you will need to use
REPLACE
function, such asREPLACE(stringValue, ' ', '')
除了使用
replace
之外,在 SQL Server 2017+ 上为了避免多个嵌套函数,如果要删除字符串中有多个字符,还可以使用translate
:删除空格、连字符、斜线:
In addition to using
replace
, on SQL Server 2017+ to avoid multiple nested functions, you can usetranslate
if there are multiple characters in a string you want to remove:Remove space, hyphen, slash:
也许尝试 替换如下
正如另一条评论中所问的
您应该将替换与 Translate 函数结合使用
Maybe try REPLACE like below
As asked in another comment
you should use replace in conjuction with Translate function