same string selection

  • Hi ,

    in my table i have values 'FAHEEM' and 'faheem',Now i have to select 'faheem' but SQL treat both as same ,

    PLz suggest.

    Best Regards
    Faheem latif
    Senior Database Architect
    Genie Technologies (Pvt.) Ltd.

  • use the query:select column_name from table_name where cast(column_name as varbimary)=cast('FAHIEN' as varbinary):)

    ---
    Thinking is the hardest work there is, which is the probable reason so few engage in it.

    Sunitha
    😎

  • faheemlatif (3/10/2008)


    Hi ,

    in my table i have values 'FAHEEM' and 'faheem',Now i have to select 'faheem' but SQL treat both as same ,

    PLz suggest.

    You could also use the COLLATE keyword (e.g. if you do not want binary comparison, you still want to compare the strings based on language rules).

    example:

    select 1 where 'FAHEEM' = 'faheem' COLLATE SQL_Latin1_General_Cp1_CS_AS

    The above will use the Latin1 collation with case sensitivity and accent sensitivity.

    Regards,

    Andras


    Andras Belokosztolszki, MCPD, PhD
    GoldenGate Software

  • And, Andras' method will allow an index to be used if there is one. The conversions to VarBinary will not.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Hi all,

    Thanks for help full solution.

    Best Regards
    Faheem latif
    Senior Database Architect
    Genie Technologies (Pvt.) Ltd.

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

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