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)
 BCP errors

Author  Topic 

vwilsonjr
Starting Member

45 Posts

Posted - 2003-04-01 : 20:31:37
I keep getting this error
Password:
NULL
Starting copy...
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

************This is the script I'm running***************

create table envoy.dbo.appuser_temp (fname varchar(25), lname varchar(25), dte varchar(8))

exec master..xp_cmdshell 'bcp envoy..appuser_temp in e:\sqldata\tst.txt -c -t" "'
select fname, lname, convert(datetime,dte,1)
from appuser_temp

************ Flat File data ***************************
The file it self is a flat file with the correct spacing.
THOMAS SMITH MECHANIC 09/06/83

Thanks for the help this is driving me crazy

robvolk
Most Valuable Yak

15732 Posts

Posted - 2003-04-01 : 21:20:21
If it is a FIXED-LENGTH file, you cannot specify a column terminator/delimiter using the -t flag. You need to use a bcp format file to indicate the lengths of each column in the text file and specify an empty ("") column terminator. Books Online has more details on "bcp format files", and if you need more help you should post some sample data from the actual file.

Go to Top of Page
   

- Advertisement -