Accents get lost

  • Hello,

    I have had problems running insertion statements with German strings in the past: e.g. ü was replaced by ý. This problem only occured when the statement was run using osql/isql.

    When using the query analyser everything went fine.

    My solution: use SQLCMD.

    Now the next problem occurs and I do not understand what happens:

    In the script below you can see the following:

    A temporary table is created named #HC_Input

    The fields all have their own collation

    The field will contain comparable strings in dutch (NL), english (UK), german(GE) and Polisch (PL)

    In the next statement 1 record is added.

    My problem is the Polish field where is to be put: Konto księgowe R.O.V.

    But when the Next statement is executed (select * from HC_Input) the result is Konto ksiegowe R.O.V.

    The ę is replaced by an e

    The final statment is to clean up the database

    The database collation for ALL databases (incl. Master, Model and TempDB) is Latin1_General_CI_AS

    How can is store all my Polish accents?

    Kind regards,

    Jefta

    [font="Courier New"]SET NOCOUNT ON

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    CREATE TABLE #HC_Input(

    [NL] [nvarchar](50) COLLATE Latin1_General_CI_AS NULL,

    [GE] [nvarchar](50) COLLATE Latin1_General_CI_AS NULL,

    [UK] [nvarchar](50) COLLATE Latin1_General_CI_AS NULL,

    [PL] [nvarchar](50) COLLATE Polish_CS_AS NULL

    ) ON [PRIMARY]

    GO

    INSERT INTO #HC_Input (NL, GE, UK, PL) values ('R.O.V. grootboekrekening','R.O.V. Hauptbuchkonto','R.O.V. ledger account', 'Konto księgowe R.O.V.' COLLATE Polish_CS_AS)

    Go

    Select * from #HC_Input

    GO

    DROP TABLE #HC_Input

    GO[/font]

  • You need to tell SQL that your inserts are unicode. To do so apply the N before all strings.

    N'Konto ksiegowe R.O.V.'

  • Wow, that's a great service!

    It solves my problem indeed.

    Thanks

    Jefta

  • NP, thanks for the feedback.

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

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