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:
01657166
Views:
49
>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
"Navision is evil that needs to be erazed... to the ground"

Jabber: gorila@dione.zcu.cz
Jabber? Jabbim
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform