Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there a way to output bad records using BCP utility?

Status
Not open for further replies.

Guest_imported

New member
Joined
Jan 1, 1970
Messages
0
HI,
I am trying to track down the records that will not insert using the BCP utility in dos. I am using BCP for batch reasons.I know I can output the error messaging using the "-o" command. This particuar file loads with these errors:

1000 rows sent to SQL Server. Total sent: 9000
SQLState = 22001, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]String data, right truncation
1000 rows sent to SQL Server. Total sent: 10000

Now I know that somewhere between 9000 records and 10,000 records it could not load...but which one. Is there a way to narrow this down?

thanks for all your help
--scotta
 
-o directs the output of BCP to a file. -e directs errors to a file. Use the -e option.

SQL BOL description of -e option:

-e err_file

Specifies the full path of an error file used to store any rows bcp is unable to transfer from the file to the database. Error messages from bcp go to the user’s workstation. If this option is not used, an error file is not created.
Terry L. Broadbent - DBA
Computing Links:
faq183-874 contains "Suggestions for Getting Quick and Appropriate Answers" to your questions in the SQL Server forum. Many of the ideas apply to all forums.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top