all groups > sql server full text search > february 2004 >
You're in the

sql server full text search

group:

Check a field for extended characters ??


Check a field for extended characters ?? Joseph Eck
2/17/2004 11:52:53 AM
sql server full text search:
I am working on a project for my company. I am setting a flag when an error
occurs in the data. My "source" field can contain any characters in the
standard ASCII character set, but I want the flag to set when an extended
character (ASCII code 31 or less, or 128 and above) has been found. The
main problem I have is that the character can be anywhere in the field...

This is what I currently have:
UPDATE jwars_blue_equip SET davie_err_flag = davie_err_flag ||
'9999-source,' WHERE source NOT BETWEEN CHAR(32) AND CHAR(127);

It's close, but not what I need. As you can see, this example above reads
the source field in, when I really need to check it one character at a
time...

Please help if you can, and thanks in advance.


Re: Check a field for extended characters ?? John Kane
2/17/2004 1:31:23 PM
Joseph,
You should checkout the UNICODE function in SQL Server's Books Online title
"UNICODE"

DECLARE @nstring nchar(12), @extended int
SET @nstring = N'Åkergatan 24'
set @extended = UNICODE(@nstring)
print @extended -- returns: 197

The BOL has a more complex example using SUBSTRING, UNICODE, CONVERT and
DATALENGTH to check each of the characters in the string. I think this is
what you're looking for...

Regards,
John




[quoted text, click to view]

AddThis Social Bookmark Button