Re: BCP error 22001 - String data, right truncation



The imbedded CRLF's would definitely cause the problem. Generally I have my
application developers strip those types of garbage characters out before
allowing it to be saved to the database. The characters usually provide
them as much of a problem when they later try to redisplay the data as when
you try to use it directly in the database.

Glad to hear it's working now!

--
--Brian
(Please reply to the newsgroups only.)


"Leslie" <mason@xxxxxxxxxxxxxxxx> wrote in message
news:66ED84D5-A469-4E29-BE10-0033B6F17A9A@xxxxxxxxxxxxxxxx
> Brian,
>
> Thanks for the input. The schema for the tables match. I think the problem
> was imbedded CRLFs. The text data is entered via the web and I think
> people
> are pressing enter at the end of a line and then starting a new line.
> Would
> this sound like the kind of thing that would cause the problem?
>
> Once I switched to native mode (-n) the problem went away.
>
> Thanks for your help.
>
> "Brian Lawton" wrote:
>
>> First be sure the table schema on the target server matches the one on
>> the
>> source server. After that, be sure the column delimiters in your data
>> file
>> are such that any imbedded commas within the data are not causing a
>> problem
>> when reading the data. As a possible solution, try using the Native Type
>> option (-n) when you export/import the data rather than saving it as
>> text.
>> Beyond that, you'd need to post more information detailing exactly how
>> you
>> are performing the bcp.
>>
>> --
>> --Brian
>> (Please reply to the newsgroups only.)
>>
>>
>> "Leslie" <mason@xxxxxxxxxxxxxxxx> wrote in message
>> news:21F78426-D27C-474C-A48D-09CEEB22581D@xxxxxxxxxxxxxxxx
>> >I am using bcp to copy a table from one sql server to another. The bcp
>> >out
>> > seems to work fine. However, when I attempt to bcp the data back in, I
>> > get
>> > the following errror:
>> >
>> > Starting copy...
>> > SQLState = 22001, NativeError = 0
>> > Error = [Microsoft][ODBC SQL Server Driver]String data, right
>> > truncation
>> >
>> > The source SQL Server is: Microsoft SQL Server 2000 - 8.00.760
>> >
>> > The destination SQL Server is: Microsoft SQL Server 2000 - 8.00.871
>> >
>> > What do I need to do to resolve this error?
>> >
>> > Thanks,
>> >
>> > Leslie
>>
>>
>>


.



Relevant Pages