The ltrim/rtirm cannot remove the space of data?

本文探讨了在执行特定T-SQL语句时遇到的LTRIM和RTRIM函数未能按预期工作的奇怪问题。通过详细分析和社区论坛的帮助,找到了问题的根源在于字符末尾的换行符而非空格,并提供了有效的解决方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Today, I met one strange problem; when the following T-SQL statement was executed, the desired result was not presented:

What happened to the ltrim and rtrim, I copied the value of '105151 ' and then verify the rtrim by the following statement:

The function works well. So where is the problem? I used the Google to search the relevant topic, I found one post at the http://social.msdn.microsoft.com/Forums/en-US/transactsql/thread/ed5d3d85-a276-4487-be05-0a5c06f82722

And yes, it's the problem. I executed the following T-SQL statement and got the following result:

It seems that the last character is the new line, not the space. Now, what need to be done is replace this symbol to space or empty. Thing became simple:

转载于:https://www.cnblogs.com/yang_sy/archive/2011/03/16/1986056.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值