Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Needle in a haystack

Author  Topic 

SamC
White Water Yakist

3467 Posts

Posted - 2003-03-18 : 18:01:46
I have a bcp procedure that imports a CSV file of 30,000 rows into a working table.

I get a few errors reported as so:

Starting copy...
1000 rows sent to SQL Server. Total sent: 1000
SQLState = 22001, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]String data, right truncation
SQLState = 22001, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]String data, right truncation
SQLState = 22001, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]String data, right truncation
SQLState = 22001, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]String data, right truncation
SQLState = 22001, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]String data, right truncation
1000 rows sent to SQL Server. Total sent: 2000
1000 rows sent to SQL Server. Total sent: 3000
1000 rows sent to SQL Server. Total sent: 4000
1000 rows sent to SQL Server. Total sent: 5000
1000 rows sent to SQL Server. Total sent: 6000
SQLState = 22001, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]String data, right truncation
SQLState = 22001, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]String data, right truncation
1000 rows sent to SQL Server. Total sent: 7000
1000 rows sent to SQL Server. Total sent: 8000
1000 rows sent to SQL Server. Total sent: 9000
SQLState = 22001, NativeError = 0


Is there any way to get bcp to state the exact row so I can have a look at what string data is being right truncated??

Sam

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2003-03-18 : 18:09:43
You could create a staging table with a wider row (each column wider) so that it fits...then run queries against that staging table to find the rows that were too big to fit in your original table.

Just one idea....

Jay White
{0}
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2003-03-18 : 18:21:49
The errors are gone.

Now I'm left wondering what it was. Maybe more sleuth work is due.

Sam

Go to Top of Page

Guttless
Starting Member

2 Posts

Posted - 2007-02-26 : 14:34:59
I am having the same problem you were having with the BCP error, except it will not load not even one row.

SQLState = 22001, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]String data, right truncation

I have checked my fields on the source and destination tables, same schema. I have no idea what the problem is at this point.

Here are my out and in commands:

bcp "exec IRIS.dbo.QualifyMedClaims" queryout S:\Atlanta\_AE\ExtractClaims_10_tmp.dat -Snameofserver -N -T -k -E

bcp IRIS.dbo.ExtractClaims_10_2 in S:\Atlanta\_AE\ExtractClaims_10_tmp.dat -nameofserver -N -T -k -E
Go to Top of Page
   

- Advertisement -