Bulk copy error handling?

  • I inherited a process that uses bulk copy (bcp) to load data to staging tables from text files using character format files. The process fell over last week when it tried loading '01/01/0001 00:00:000' to a datetime column. I haven't been able to find much about error handling with bcp; does anyone have any suggestions for ways to account for this in the future?

  • BCP was designed to be fast...not tolerant of bad data or feature-rich.

    If you have data quality issues then you can ask for better data or cleanse it after you get it and before you try loading it.

    If you can't do either then load the data into a VARCHAR column and do the cleansing in T-SQL.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • Yeah, that's what I was thinking I was going to have to do. Thanks...

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

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