I am using BCP in MSSQL for importing flat file data into table. File has line feed character (0A) as row separator. I am using below bcp query to import file
bcp dbo.BCPTest in O:\BCPTest\test.txt -c -t| -r 0x0A -T -h TABLOCK
I am getting:
SQLState = 22001, NativeError = 0 Error = [Microsoft][SQL Server Native Client 10.0]String data, right truncation warning.
How to get field name which has truncation issue in BCP.
My suggestion would be to use the error file option on the command. I use this to get a more descriptive error from sql server.
-e err_file Specifies the full path of an error file used to store any rows that the bcp utility cannot transfer from the file to the database. Error messages from the bcp command go to the workstation of the user. If this option is not used, an error file is not created. If err_file begins with a hyphen (-) or a forward slash (/), do not include a space between -e and the err_file value.