How to select arabic or english when column have both english and arabic?

  • Hi,

    How to select arabic or english when column have both english and arabic?

    Please help me

  • Hi

    whats the collation of the column. u can use convert/CAST with collate keyworkd for getting the data in desired colllation (language) . Is this what u require ?

    SELECT ....

    cast(table1.col1 as VARCHAR(50)) collate ARABIC_CI_AI

    from table1.

    "Keep Trying"

  • Hi,

    Thanks for replay, But will it select rows which contains only arabic record if coulmn has both arablic and english records, also it has arabic collation on that column already?

  • I think it should select arabic values. Collation also depends on the regional settings of the machine from whihc the query is exeuted.

    I cannot setup a Arabic collated machine, so i cant play around and tell u the exact results.

    I did a application long back which had to support both arabic ane english . For this we had 2 columns one for english other for arabic. Ex:- FirstName VARCHAR(50) - Default collation english. FirstNameArabic VARCHAR(50) - collation being ARABIC_BIN. In the regional options the locale was changed (dont remeber which).

    Another approach is using unicode data types

    Any way check out if ur queries work with collate keyword.

    "Keep Trying"

  • If the arabic script has no Roman/English characters in it, you should be able to use the following WHERE clause.

    WHERE MyColumn not like '[a-z]%'

    And if your collation is set up as case sensitive, add:

    AND MyColumn not like '[A-Z]%'

    Be warned, this will probably be very query intensive and could cause a major performance hit depending on how many records you're searching. But it might be the only way to do what you're attempting.

    Let us know if our suggestions don't help.

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

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

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