error in bulk copy

  • Hi

    I want to test some changes in the structure of a table and see the plan,I exported the data in a text file using bulk copy,the table is about 400G and 120000000 records.

    bcp DB.dbo.[Table] out "G:\sqlscript.txt" -c -T

    after that I create the table in another test server ,using the primary structure of the table from Main server and the same collation

    I imported the data in new table with this command

    bcp Test.dbo.[Table2] in "G:\sqlscript.txt" -c -T -e G:\error.txt

    but from 120000000 records ,it inserted just 1000000 records and in command prompt I have :

    sqlstate =22005 , nativeerror=0 error = [microsoft][sql server native client 10.0]invalid character value for cast specification

    and in error.txt file :

    #@ Row 951577, Column 8: Invalid character value for cast specification @#

    please help me

  • I would use -N option (native mode) for what you are doing instead of -c

    The probability of survival is inversely proportional to the angle of arrival.

  • Thanks a lot

    It worked 🙂

  • A gain I have problem with bcp in.It worked for that table but when I want to try it for another table I got this error in error file:

    #@ Row 52, Column 2: String data, right truncation @#

    This column is varchar,I checked the previous table and it dosen't contain any varchar column.how can I solve this ?

    It took me a lot of time to export the data 🙁

  • I used format file and now it is inserting.

    bcp DB.dbo.[Table] format nul -T -N -f t_n.fmt

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply