dbTalk Databases Forums  

When I compare two string in Unicode format.

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss When I compare two string in Unicode format. in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Laurent Liegeois
 
Posts: n/a

Default When I compare two string in Unicode format. - 07-30-2003 , 04:43 AM






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(4 1273)



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 ***
Don't just participate in USENET...get rewarded for it!

Reply With Quote
  #2  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: When I compare two string in Unicode format. - 07-30-2003 , 03:15 PM






[posted and mailed, please reply in news]

Laurent Liegeois (zoltix (AT) skynet (DOT) be) writes:
Quote:
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(25736)+nchar(1788)+nchar(51220)+nchar(17733)

Set @str2 =
nchar(21121)+nchar(49352)+nchar(47811)+nchar(48256 )+nchar(4966)+
nchar(25736)+nchar(1788)+nchar(51220)+nchar(17733) +nchar(41273)
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 (AT) algonet (DOT) se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.