locked
bcp utility for format command : for converting the value RRS feed

  • Question

  • I having file with data as below  and data is float in Database . How to convert the value from file or replace , with empty

    "-28,750.00"^"-28,750.00"^"-1,000,000"^"5.75"

    and format file 

    11.0
    5
    1         SQLCHAR             0       0        "\""        0     ""                                   ""
    2         SQLCHAR             0       41      "\"^\""      1    CASH1                                   ""
    3         SQLCHAR             0       41      "\"^\""      2    CASH2                                   ""
    4         SQLCHAR             0       41      "\"^\""      3    CASH3                                  ""
    5         SQLCHAR             0       41      "\"\r\n"     4    CASH4                                  ""

    How to handle such value using bcp utility



    • Edited by Fabcoder Tuesday, April 17, 2018 11:59 AM
    Tuesday, April 17, 2018 11:51 AM

All replies

  • With bcp, you need to retrieve file data as varchar onto a staging table and then do the parsing to remove the , characters before you convert it to decimal to dump to your final table

    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    ----------------------------
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

    Tuesday, April 17, 2018 12:00 PM