PATINDEX bug?

  • This is really wierd and I hope someone can shed some light -

    Why does doing this pattern search hit on the lower case 'a'?

    SELECT PATINDEX ('%[¾-À]%', 'abcdefghijk')

    Same this as doing:

    declare @Pattern varchar(250)

    set @Pattern = '%['+char(190)+'-'+char(192)+']%'

    SELECT PATINDEX (@Pattern, 'abcdefghijk')

    Now if I look for these characters individually, it does not find anything..Is this an MS bug?

    Any help is appreaciated, thanks..

  • kung lao, one post is adequate for your purposes, we will see it. please stop double posting.


    Everything you can imagine is real.

  • sorry, I needed a quick answer so I can get out a script today - won't do it again..

  • You need to specify a collation that distinguishes between upper and lower case, such as...

    declare @Pattern varchar(250)

    set @Pattern = '%['+char(190)+'-'+char(192)+']%'

    SELECT PATINDEX (@Pattern collate Latin1_General_BIN,'abcdefghijk')

     



    PeteK
    I have CDO. It's like OCD but all the letters are in alphabetical order... as they should be.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply