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

被折叠的 条评论
为什么被折叠?



