detect trailing spaces

  • Hi

    Can anyone suggest me how to find if there are any trailing spaces in a field?

    I would appreciate it.

    Thanks

  • SELECT MyColumn FROM MyTable

    WHERE RIGHT(MyColumn, 1) = ' '

    John

  • Thanks a lot

    God Bless you

  • Hmmm...or more circuitously:

    Select * From table where len(myColumn) + 1 <> len(myColumn + '.')

    I'm sure there's a flaw in my logic here, but the idea is to exploit the behavior of the len function, which does not count trailing spaces.

    (I discovered this the hard way....)

  • That works, Jeremy. Not sure why anyone would do it, but it does work. 🙂

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply