BCP Import Error- numbers interpreted as ascii

  • Trying to import the following line using bcp

    1;1;Tiger Woods;64;25.7;296;1,152

    with the format file

    7.0

    7

    1 SQLINT 0 4 ";" 1 THISWEEK

    2 SQLINT 0 4 ";" 2 LASTWEEK

    3 SQLCHAR 0 100 ";" 3 PLAYER

    4 SQLINT 0 4 ";" 4 ROUNDS

    5 SQLFLT8 0 8 ";" 5 PERCENTAGE

    6 SQLINT 0 4 ";" 6 BIRDIES_EAGLES

    7 SQLINT 0 4 "" 7 HOLES_PLAYED

    but it messes around with the integers so that it looks like it converts it to ascii

    THISWEEK LASTWEEK PLAYER ROUNDS PERCENTAGE BIRDIES_EAGLES HOLES_PLAYED

    ----------- ----------- ---------------------------------------------------------------------------------------------------- ----------- ----------------------------------------------------- -------------- ------------

    49 49 Tiger Woods 13366 4.5739369936478948E-315 3553586 892415025

    Using the command

    c:\mssql7\binn\bcp pga..PGA_PARBREAK in d:\parcheck.txt -S c

    larcombe -U sa -P -f PGAPARBREAK.fmt -t ;

    Anyone know how to get around this at all ?

    TIA

  • Use SQLCHAR for the input fields, sql server will convert where necessary. SQLINT expects the data to be binary.

    Far away is close at hand in the images of elsewhere.
    Anon.

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

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