Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2003
    Location
    Ottawa
    Posts
    105

    Unanswered: BCP delivery the: character

    Using the BCP utility ->

    With a degree character in the flat data file, can anyone deliver this to a table without SQL Server changing it to stacked bar:


    Code:
    CREATE TABLE "dbo"."F_conv"
    	(
    	"col1" VARCHAR(21) NOT NULL
    	)
    ;
    myformat.fmt

    Code:
    8.0
    1
    1	SQLCHAR	0	30	"\r\n"	1	col1	""
    mydata.dat file

    Code:
    1332 NS 4 Tall 32 oz
    bcp command
    Code:
    bcp "MY_DB"."dbo"."F_conv" in "mydata.dat" 
    -q -S<server> -Usa -Psa -f"myformat.fmt"
    You're obsessed and distressed 'cuz you can't make any sense
    Of the ludicrous nonsense and incipient senescence
    That will deem your common sense useless

  2. #2
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    I don't think declaring the column as VARCHAR(...) will satisfy your requirements. I changed your sample to NVARCHAR(32) for the column and got a little closer (char(166) instead of char(176) for the degree sign) and then was able to perform a REPLACE on the column. I am pretty sure you also need to address collation of the column to ensure that your data gets imported correctly.
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

  3. #3
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Try taking BCP out of the picture, and use:
    Code:
    CREATE TABLE dbo.tDstachon (
       col1 	CHAR(21)	NOT NULL
    )
    GO
    
    BULK INSERT dbo.tDstachon FROM 'c:\dstachon.txt'
    BULK INSERT dbo.tDstachon FROM 'c:\dstachon.txt' WITH (CODEPAGE = 'ACP')
    
    SELECT * FROM dbo.tDstachon
    -PatP

  4. #4
    Join Date
    Jun 2003
    Location
    Ottawa
    Posts
    105

    thanks

    thanks guys.

    cheers,
    d.
    You're obsessed and distressed 'cuz you can't make any sense
    Of the ludicrous nonsense and incipient senescence
    That will deem your common sense useless

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •