• honza.mf (5/25/2010)


    jlennartz (5/25/2010)


    If all characters were inserted into DB as upper case how come query is returning lower case?

    It's another aspect of this question not mentioned yet: All characters inserted into are not guaranted to be uppercase!

    You feel they are uppercase due to "while @a2 <= 'Z'" condition. You must evaluate this condition in appropriate collation too. Most of us use case-insensitive collations and in such collations lowercase letters also fit this condition. And it si true for the special characters between 'Z' and 'a' in ASCII table like '[', '\', ']' - it's not obvious but for me it's clear. There can be even more characters that fit, it's collation dependant.

    If someone uses case sensitive collation, he will have all characters in uppercase.

    Quite correct. The actual number of rows in #t with a default installation is 20449. To get the 26 by 26 result requireswhile ASCII(@a1) <= ASCII('Z') begin, etc.

    This QotD turned out to be much more interesting than I initially thought it would.

    Thanks for the lesson!

    Tom Garth
    Vertical Solutions[/url]

    "There are three kinds of men. The one that learns by reading. The few who learn by observation. The rest of them have to pee on the electric fence for themselves." -- Will Rogers