April 28, 2008 at 9:44 am
Hi
Can anyone suggest me how to find if there are any trailing spaces in a field?
I would appreciate it.
Thanks
April 28, 2008 at 9:51 am
SELECT MyColumn FROM MyTable
WHERE RIGHT(MyColumn, 1) = ' '
John
April 28, 2008 at 10:05 am
Thanks a lot
God Bless you
April 28, 2008 at 10:52 am
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....)
April 28, 2008 at 10:58 am
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