BCP Character Set Conversion Problem

  • Tools: I am using BCP In sql Server 2000 Standard Edition.

    Goal: is to export data from a table to a tab separated file using BCP from within a stored Procedure.

    Problem: BCP Converts Ascii(197) To Ascii(143) On Export

    The Record contains a barcode field. This field is used to generate a barcode on a mail merge document.

    A typical barcode may look like this:  

    }#05&d!uEÅ5.%vH!Nt~

    When The Above is exported using BCP I Get:

    }#05&d!uE5.%vH!Nt~

    It is constantly converting the Å to 

    Why?

    Is it correctable?

    When Using DTS everything works fine.

     

    Thanks In advanced For Your Help!

    PS - The Export Code:

    SET @Command = 'bcp "Database..qryName" out "C:\Exp.tsv" -c -T -S Server'

      EXEC master..xp_cmdshell @Command

  • How are you confirming that it changed from 197 to 143 as far as character. Many times it is just choice of font that gives the impression. Look at in hex format to make sure what the character actually is.

  • When we import the data into the mail merge system the barcode interpreted the characters improperly so that’s how we know it is incorrect. so after taking a closer look at the data before and after the export I noticed the different characters. I changed the fonts to confirm that it wasn’t a display issue.

    I got the ASCII values by coping the chars into QA and typing Select ASCII('<Char>')

    Thank you for your input. Any other suggestions you or anyone else may have are greatly appreciated.

  • I found the answer. for anyone interested in the issue visit

    http://support.microsoft.com/default.aspx?scid=kb;en-us;199819

    I simply needed to specify which code page to use.

    New Code:

    SET @Command = 'bcp "Database..qryName" out "C:\Exp_.tsv" -c -C1252 -T -S Server'

      EXEC master..xp_cmdshell @Command

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

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