Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Ltrim(rtrim(column_name)) does not work
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
01657158
Message ID:
01657167
Views:
33
>>Hi,
>>
>>Does SQL Server insert anything at the end of a field? I have a table PO Items. I type something in the field (from VFP application) and then press on Enter for some time, to insert a bunch of empty lines. Then save.
>>The report of this item will show a bunch of spaces below, even when I use LTRIM(RTRIM(PO_ITEM)) AS PO_ITEM in the SQL Select. If I remove the spaces at the end of the description, the report does not print empty lines. This makes me think that maybe SQL inserts some "invisible" character, like chr(13) at the end. Is it possible?
>>
>>TIA
>>
>>Update. In the SSMS when I select LEN of the trimmed field it shows the same length as non trimmed.
>>
>>select rtrim(PO_ITEM) as len_no_trim, LEN(ltrim(rtrim(PO_ITEM))) as len_trimmed from PO
>>
>>
>>So, clearly either I don't understand the user of ltrim(rtrim()) or something is at the end of the field ITEM_DESCR
>
>Because it's feature. Function LEN() ignore below and after white characters.
>
>
>select LEN('A'+PO_ITEM+'A')-2 as len_no_trim, LEN(PO_ITEM) as len_trimmed from PO --fixed
>
>
>MartinaJ

Thank you, Martina.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform