Determining Case sensitive

  • Hi All,

    I have a sql table contains Active Directory User data. This table contains First name, Last Name, Display Name columns.

    Pls give me suggestion to find the abnormality from the below condition,

    First Name - first letter should be capital

    Last Name - First Letter should be capital

    Display Name - First Name.Last Name

    I know there are certain function like UPPER, LOWER can be used. Please give me more ideas how to develop query for that.

    BR,

    Parthi

  • You can query the ASCII code for the first char:

    'a' is different from 'A'

    try this:

    SELECT ASCII('A')

    SELECT ASCII('a')

    One thing you could do is:

    SELECT *

    FROM MyTable

    WHERE ASCII(LEFT(FirstName,1)) <> ASCII(LEFT(UPPER(FirstName),1))

    Onether thing you could do is playing with COLLATION:

    SELECT *

    FROM MyTable

    WHERE LEFT(FirstName,1) COLLATE Latin1_General_CS_AS <> LEFT(UPPER(FirstName),1) COLLATE Latin1_General_CS_AS

    Hope this helps

    Gianluca

    -- Gianluca Sartori

  • Hi Gianluca,

    Thanks alot for technical information.

    I will try from my side..

    BR,

    Parthi

Viewing 3 posts - 1 through 2 (of 2 total)

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