Bulk Insert not working for dataset

  • sudishnch wrote:

    Let try below 2017 version

    I'm not sure I understand what you're saying.  If you mean to try it on something less than 2017, then here's what you get...

    Msg 102, Level 15, State 1, Line 19

    Incorrect syntax near 'FIELDQUOTE'.

    Like I said, the code isn't going to work for versions less than 2017.

    If you mean something else, then let us know, please.

    --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)

  • logan.keister wrote:

    Hello all,

    Maybe this is my own ignorance showing, but I think I've hit a brick wall. I can't seem to bulk insert a dataset. I create a temp table at the start of the query, and then try to bulk insert my .csv into it. Now, if I have a simple .csv to deal with, it works fine. However, we are trying to take a .csv that is being exported from a supplier's software and import it into the database. My problem is as is below.

    1                 2              3

    500,          200,       "1,000"

    "7,000",   300,        500

    50,           "5,243",   232

    Basically, as soon as they roll over 1,000, the software will export the number as "5,000", instead of 5000, . Any thoughts on how to cope with this? I would use a replace function of some kind, if I knew how.

    I have it working in 2017 but, I have to ask... is your data actually double-spaced in the file like what you posted above?

    --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)

  • The column is too long in the data file for row 1, column 1. Verify that the field terminator and row terminator are specified correctly.  Msg 7330, Level 16, State 2, Line 1 Cannot fetch a row from OLE DB provider "BULK" for linked server "(null)".

     

    myPennMedicine

    • This reply was modified 3 years, 8 months ago by  Mathison852.

Viewing 3 posts - 16 through 17 (of 17 total)

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