SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


LTRIM/RTRIM NOT TRIMMING


LTRIM/RTRIM NOT TRIMMING

Author
Message
eletuw
eletuw
Old Hand
Old Hand (318 reputation)Old Hand (318 reputation)Old Hand (318 reputation)Old Hand (318 reputation)Old Hand (318 reputation)Old Hand (318 reputation)Old Hand (318 reputation)Old Hand (318 reputation)

Group: General Forum Members
Points: 318 Visits: 282
I use ltrim and rtrim in select statement but the output is not trimmed. The variable are all of datatype varchar.

select ltrim(rtrim(org_name)),ltrim(rtrim(org_code)) from tableA

Does any one know what is happenning.
Thanks for your help.



ThomasH
ThomasH
SSC Eights!
SSC Eights! (961 reputation)SSC Eights! (961 reputation)SSC Eights! (961 reputation)SSC Eights! (961 reputation)SSC Eights! (961 reputation)SSC Eights! (961 reputation)SSC Eights! (961 reputation)SSC Eights! (961 reputation)

Group: General Forum Members
Points: 961 Visits: 1
Can you post the results of
 
select TOP 1 '-' + ltrim(rtrim(org_name)) + '-'
from tableA?


Might also have some unprintable or CR/LF data embedded.
(Preview of this post removed the plus signs from each side of the LTRIM(...) )



Once you understand the BITs, all the pieces come together
eletuw
eletuw
Old Hand
Old Hand (318 reputation)Old Hand (318 reputation)Old Hand (318 reputation)Old Hand (318 reputation)Old Hand (318 reputation)Old Hand (318 reputation)Old Hand (318 reputation)Old Hand (318 reputation)

Group: General Forum Members
Points: 318 Visits: 282
I think the problem in QA is setting the option to have column aligned in the result tab.

Thanks for your response.



Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search