June 27, 2011 at 3:20 pm
For the following i am getting incorrect charindex in case of 2nd select charindex('a',N'aृ'). If any character preceds 'ृ ' character in Unicode, i am not able to get the Charindex correctly
For the followin 1st stament return 1 as char index which is correct.
for the 2nd it is retunring 0 as char index which is incorrect. The reason could be Unicode and preceds by special char 'ृ '
for the 3rd getting the correct result 1. in this case also it is unicode but special char 'ृ ' is not the preceding charcter , it is at 3rd place
for the 4th with char index for b is not coming becuase it is preceded with special char 'ृ '.
Can some body explain me what is the issue with 2nd & 4th queries returning wrong results.
select charindex('a','aृ')
select charindex('a',N'aृ')
select charindex('a',N'abृ')
select charindex('b',N'abृ')
Thanks in Advance
June 27, 2011 at 4:48 pm
Collation, Collation, Collation 😉
try this : select CHARINDEX('a',N'a?' COLLATE latin1_general_bin)
Your db collation most probably not compatible with the unicode characters you are using.
MM
select geometry::STGeomFromWKB(0x0106000000020000000103000000010000000B0000001000000000000840000000000000003DD8CCCCCCCCCC0840000000000000003DD8CCCCCCCCCC08408014AE47E17AFC3F040000000000104000CDCCCCCCCCEC3F9C999999999913408014AE47E17AFC3F9C99999999991340000000000000003D0000000000001440000000000000003D000000000000144000000000000000400400000000001040000000000000F03F100000000000084000000000000000401000000000000840000000000000003D0103000000010000000B000000000000000000143D000000000000003D009E99999999B93F000000000000003D009E99999999B93F8014AE47E17AFC3F400000000000F03F00CDCCCCCCCCEC3FA06666666666FE3F8014AE47E17AFC3FA06666666666FE3F000000000000003D1800000000000040000000000000003D18000000000000400000000000000040400000000000F03F000000000000F03F000000000000143D0000000000000040000000000000143D000000000000003D, 0);
June 27, 2011 at 5:50 pm
Thanks for the early Reply & it is working with the collation mentioned by you.
I had one doubt here. How it is working with default collation for non unicode String for the same character.
June 27, 2011 at 5:52 pm
because your default collation is compatible with non-unicode characters
MM
select geometry::STGeomFromWKB(0x0106000000020000000103000000010000000B0000001000000000000840000000000000003DD8CCCCCCCCCC0840000000000000003DD8CCCCCCCCCC08408014AE47E17AFC3F040000000000104000CDCCCCCCCCEC3F9C999999999913408014AE47E17AFC3F9C99999999991340000000000000003D0000000000001440000000000000003D000000000000144000000000000000400400000000001040000000000000F03F100000000000084000000000000000401000000000000840000000000000003D0103000000010000000B000000000000000000143D000000000000003D009E99999999B93F000000000000003D009E99999999B93F8014AE47E17AFC3F400000000000F03F00CDCCCCCCCCEC3FA06666666666FE3F8014AE47E17AFC3FA06666666666FE3F000000000000003D1800000000000040000000000000003D18000000000000400000000000000040400000000000F03F000000000000F03F000000000000143D0000000000000040000000000000143D000000000000003D, 0);
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply