Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2003

    Angry Unanswered: ltrim and rtirm is not working

    Hi i have a select statement as

    select empnum, len(empnum), ltrim(rtrim(empnum)), len(ltrim(rtrim(empnum))) from employee

    When i execute this stament i get the following

    1234 6 1234 6
    4321 8 4321 8
    1111 6 1111 6
    2222 6 2222 6

    How does this happens. Why ltrim and rtrim is not working here.

  2. #2
    Join Date
    Apr 2002
    Toronto, Canada
    what are you using to display these results, query analyser? enterprise manager? something else?

    the length of 1234 is clearly not 6 | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Jun 2003
    Provided Answers: 1
    What does this yield:

    select 'X' + ltrim(rtrim(empnum)) + 'X' from employee
    If it's not practically useful, then it's practically useless.

    blindman "sqlblindman"

  4. #4
    Join Date
    Jan 2003

    ltrim(rtrim) not working

    Ive got it, the input statement is from source, and the programmers have stored vbcrlf after each string. char(13) stored at the end and that is the reason y ltrim and rtrim is not working.

    I removed the char(13) at the end and now it is working.

    Thanks for your time

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts