[thelist] MSSQL character weirdness

Mark Rees mrees at itsagoodprice.com
Mon Sep 19 11:12:39 CDT 2005


Hello

In this table, Name holds a full name, like "Graham Barrow"

I'm trying to split it on the first space. I thought this would be easy.
However this query


SELECT
ASCII(SUBSTRING(cm.Name,6,1)),
CHARINDEX(cm.Name,char(32),1) FROM TABLE

produces the following output:

32 0
32 0
80 0
32 0
32 0

etc

So ASCII says that char(32) is present, but CHARINDEX says different. I see
the same behaviour if I use a space like so ' '

Can anyone shed any light on this?

Thanks in advance for your help


www.itsagoodprice.com - top-brand electronics for less.




More information about the thelist mailing list