Home Forums SQL Server 2005 SQL Server Newbies BCP via batch file - Error = [Microsoft][SQL Native Client]Unexpected EOF encountered in BCP data-file RE: BCP via batch file - Error = [Microsoft][SQL Native Client]Unexpected EOF encountered in BCP data-file

  • rob_nye - Thursday, February 23, 2017 2:11 AM

    turns out the problem was the date field on each row.. wasnt being recognised as datetime therefore would not import

    changed process to import into a temp table with the date field as varchar
    then did an insert from temp to base table converting the date field into a bona fide datetime field 🙂

    Importing into a staging table, like you did, is usually the best way to go because it allows you to pre-validate all data long before it hits your production table.  It also makes doing "upserts" a whole lot easier, if that's something that you need to do.

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