bcp in French characters

  • Given example format file:

    8.0

    85

    1 SQLCHAR 0 1 "\"" 0 quote SQL_Latin1_General_CP1_CI_AS

    2 SQLCHAR 0 20 "\",\"" 1 Userid SQL_Latin1_General_CP1_CI_AS

    3 SQLCHAR 0 128 "\",\"" 2 Last_Name SQL_Latin1_General_CP1_CI_AS

    Import data:

    "jgray","Grày",

    Note the à in Gray.

    Table:

    CREATE TABLE [dbo].[person](

    [Userid] [nvarchar](25) NOT NULL,

    [Last_Name] [nvarchar](128) NULL,

    This imports ok with bcp.

    I thought I would need to use SQLNCHAR in bcp format file? If I use it, I start getting truncation errors like crazy. I tried increasing field lengths, but still no dice.

    Also, when it says column 9 would get truncated, that's actually column 10 because format file has the first field defining the beginning of the text delimiter?

  • Most of the French alphabet is supported by Char/Varchar.

    It gets complex, and the documentation is seriously (a) vague, and (b) incomplete.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Sailor (11/29/2012)


    Given example format file:

    8.0

    85

    1 SQLCHAR 0 1 "\"" 0 quote SQL_Latin1_General_CP1_CI_AS

    2 SQLCHAR 0 20 "\",\"" 1 Userid SQL_Latin1_General_CP1_CI_AS

    3 SQLCHAR 0 128 "\",\"" 2 Last_Name SQL_Latin1_General_CP1_CI_AS

    Import data:

    "jgray","Grày",

    Note the à in Gray.

    Table:

    CREATE TABLE [dbo].[person](

    [Userid] [nvarchar](25) NOT NULL,

    [Last_Name] [nvarchar](128) NULL,

    This imports ok with bcp.

    I thought I would need to use SQLNCHAR in bcp format file? If I use it, I start getting truncation errors like crazy. I tried increasing field lengths, but still no dice.

    Also, when it says column 9 would get truncated, that's actually column 10 because format file has the first field defining the beginning of the text delimiter?

    Typically french encoding characters are in your standard 8-bit ANSI encoding. What that means is that you don't want to use SQLNCHAR which does Unicode imports (probably UCS-2). Past that though, I usually use bulk insert so I'm not sure that I'd be much help with bcp. One thing I have run into with french language imports is that if the code page isn't set to 1252, Latin1 (ANSI), sometimes it will drop the accents off of characters. I'm not sure how to work it into bcp but you might try adding a "-C 1252" and see if that works. It is odd that your collation settings in the format file don't work but I don't have any experience with format files.

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

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