4

I am trying to clean up some email addresses in sql server. I can see examples of the problematic emails, and they look like this:

abc123 @xyz.com

However, when I try to run a query to find folks like these, say with:

NOT CHARINDEX(' ',LTRIM(RTRIM([Email_Address]))) = 0

or

Email_Address like '% %'

my query returns no results.

Any idea what gives?

Thanks for the quick answers. It was a Non-Breaking Space -- Char(160). The sql ASCII() function came in handy to find it.

0

4 Answers 4

10

Is it definitely a space in there or could it be some other non-printing character?

8

Two possibilities occur:

  1. it's not a SPACE character. Check it for TAB or a non-printing ASCII haracter.

  2. there's nothing there at all and your display font is kerned weird.

3

I would dump it to Vim or UltraEdit or [insert text editor of choice] and look at it in hex. Then you can easily tell if this is a space character or something else.

3

It maybe not be the actual space that comes from your space bar. I'd say try to dump the results to a text file, open it with Notepad, copy and paste the "space" from Notepad.

One of the reasons I hope they don't change Notepad, the lack of support for more advanced characters allows you to do something like this.

1
  • Yup, SQL viewers can render text oddly to ensure fixed-width readability causing characters to look as if they're half-rendered, or with additional space. Jan 7, 2009 at 15:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.