这是在SQL Server 2005中我有一个varchar栏和一些行包含尾随的空间,例如abc,def.
我尝试使用此命令删除尾随空格:
update thetable
set thecolumn = rtrim(thecolumn)
Run Code Online (Sandbox Code Playgroud)
但尾随空间仍然存在.我试图找到它们使用:
select *
from thetable
where thecolumn <> rtrim(thecolumn)
Run Code Online (Sandbox Code Playgroud)
但它没有任何回报.
是否有一些我不知道会影响尾随空间检查的设置?
编辑:
我知道SSMS有尾随空格,当我将值从网格粘贴到编辑器时,它有尾随空格.
ric*_*fox 14
检查未删除的空格是否具有ASCII代码32.尝试将"硬空间"替换为"软空间":
update thetable set thecolumn = rtrim(replace(thecolumn, char(160), char(32)))
Run Code Online (Sandbox Code Playgroud)
查询缺少等号
你确定它是一个空间(ascii 32)角色吗?您可以使用其他"不可见"字符获得奇怪的行为.试试跑步
select ascII(right(theColumn, 1))
from theTable
Run Code Online (Sandbox Code Playgroud)
看看你得到了什么.
| 归档时间: |
|
| 查看次数: |
11053 次 |
| 最近记录: |