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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

bcp errors

Status
Not open for further replies.

smsinger3

Programmer
Oct 5, 2000
192
US
Hello all. I am using bcp to copy a table to another database. In the new database, I execute a CREATE TABLE tsql statement to re-create the table. Then, I use bcp to load the table. I keep getting these errors:

SQLState = 22001, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]String data, right truncation
SQLState = 22003, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]Numeric value out of range
SQLState = 22003, NativeError = 0
Error = [Microsoft][ODBC SQL Server Driver]Numeric value out of range
BCP copy in failed


I would not think that I should receive these errors if I re-create the destination table exactly like the current table.

Any ideas?

Tnanks in advance for your help.

Steve
sms@hmbnet.com

 
Here is the bcp statement:

bcp dbname.dbo.tablename in d:\tablename.bcp -SServerName -Uuser -Ppwd -N

Thanks for your help!

Steve
 
Is the input file a fixed width or delimited file? If the file is fixed width you must provide a format file so bcp can properly select data for each table column.

If the files is delimited, you may need to indicate the field and row delimiters with the -t and -r options.

bcp dbname.dbo.tablename in d:\tablename.bcp -SServerName -Uuser -Ppwd -N -t\, -r\n


-t field_term

Specifies the field terminator. The default is \t (tab character). Use this parameter to override the default field terminator.

-r row_term

Specifies the row terminator. The default is \n (newline character). Use this parameter to override the default row terminator.
Terry

Neither success nor failure is ever final. -Roger Babson
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top