Euro Symbol and Collations

  • I'm looking to see if I can support all Western European languages in Non-Unicode columns and the first thing that sprang to mind was supporting the Euro currency symbol €.

    It seemed to work, but when I changed the Collation to SQL_Latin1_General_CP850_CI_AI it failed unless I declared the value as NVARCHAR.  I'm forced to work with this Collation due to inherited Databases.

    Can anyone explain why the difference between Collations and, out of interest, why does it return two ? rather than 1 ?

    Ideally I don't want to have to use NVARCHAR when I think VARCHAR should be sufficient to support Western European languages (if we exclude Greek), but happy to be corrected by any scholars of orthography if they know better.

    CREATE DATABASE CollationTest1 COLLATE Latin1_General_CI_AI
    CREATE DATABASE CollationTest2 COLLATE SQL_Latin1_General_CP850_CI_AI
    GO
    USE CollationTest1
    GO
    DECLARE @test VARCHAR(5) ='€';
    SELECT 'Latin1_General_CI_AI' AS DBCollation, @test AS VarcharText;
    GO
    USE CollationTest2
    GO
    DECLARE @test VARCHAR(5) ='€';
    SELECT 'SQL_Latin1_General_CP850_CI_AI' AS DBCollation, @test AS VarcharText;
    GO

    DECLARE @test NVARCHAR(5) = N'€';
    SELECT 'SQL_Latin1_General_CP850_CI_AI' AS DBCollation, @test AS NvarcharText;
    GO

    Screenshot 2022-10-28 163648

  • Thanks for posting your issue and hopefully someone will answer soon.

    This is an automated bump to increase visibility of your question.

  • Not sure why it displays double ??

    Wikipedia contains an overview of western codepages https://en.wikipedia.org/wiki/Western_Latin_character_sets_(computing)

    https://en.wikipedia.org/wiki/Code_page_850

    Looks like is is due memory limitations in the earlier days of MS-DOS

  • Generate your test code:

    Select 'DECLARE @test VARCHAR(5) = ''€'';
    SELECT convert(char(100),'''+name+''' ) AS DBCollation, @test collate ' + name + ' AS VarcharText;
    GO
    ' SelectQueries
    from fn_helpcollations()
    where name like '%latin%'
    order by name;

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

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

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