all groups > sql server (alternate) > july 2003 >
You're in the

sql server (alternate)

group:

When I compare two string in Unicode format.


When I compare two string in Unicode format. Laurent Liegeois
7/30/2003 9:43:12 AM
sql server (alternate):
Hi,
I have a funny Error in our sql server 7 & 2000. When I compare two
string in Unicode format. I receive that it is the same when I add new
nchar.
I don’t understand why?


Could you help me ?

declare @str nvarchar(128), @str2 nvarchar(128)



Set @str =
nchar(21121)+nchar(49352)+nchar(47811)+nchar(48256)+nchar(4966)+nchar(25
736)+nchar(1788)+nchar(51220)+nchar(17733)

Set @str2 =
nchar(21121)+nchar(49352)+nchar(47811)+nchar(48256)+nchar(4966)+nchar(25
736)+nchar(1788)+nchar(51220)+nchar(17733)+nchar(41273)



select @str

select @str2

SELECT DIFFERENCE(@str, @str2)



if soundex(@str) = soundex(@str2)

BEGIN

SELECT 'OK'

END

ELSE

BEGIN

SELECT 'KO'

END

if @str = @str2

BEGIN

SELECT 'OK'

END

ELSE

BEGIN

SELECT 'KO'

END


-=zoltux=-

*** Sent via Developersdex http://www.developersdex.com ***
Re: When I compare two string in Unicode format. Erland Sommarskog
7/30/2003 8:15:41 PM
[posted and mailed, please reply in news]

Laurent Liegeois (zoltix@skynet.be) writes:
[quoted text, click to view]

When I use the Character Map in Windows (Under Accessories/System Tools),
I cannot find any character defined at U+A139 (=41273). I would suppose
that a trailing undefined character counts as blank, which explains why
@str1 = @str2 are equal.



--
Erland Sommarskog, SQL Server MVP, sommar@algonet.se

Books Online for SQL Server SP3 at
AddThis Social Bookmark Button