Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Ltrim(rtrim(column_name)) does not work
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
01657158
Message ID:
01657166
Vues:
51
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform