bulk insert

  • I have to bulk insert the data from  csv file into orders table. I am trying to use following code but fail to import/insert.

     bulk insert orders

    from 'c:\orders.csv'

     WITH

          ( FIRSTROW = 2, DATAFILETYPE = 'native', FIELDTERMINATOR = '\c', ROWTERMINATOR = '\n',CODEPAGE = 'RAW'    )

     Error message which I m getting is:

     Bulk Insert fails. Column is too long in the data file for row 1, column 1. Make sure the field terminator and row terminator are specified correctly.

     Kindly tell me how to do that.

    Thx in advance.

  • You have to specify the characters denoting each field and rows.

    What are they in your file? These are the ones you should use. Also, is the file native and not plain ASCII?

    /Kenneth

  • The datafile type would certainly not be "Native" if you are trying to input CSV.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Hi

     

    Can you post the first line you are using to import via bcp.

    Some problems are related on separator and/or delimitator row.

     

     

     

     

     


    Hildevan O Bezerra

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

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