Results 1 to 7 of 7

Thread: Bcp

  1. #1
    Join Date
    Nov 2002
    Posts
    3

    Unanswered: Bcp

    Hi Folks,

    I am tring to import data using bcp command.

    bcp LNTtest..Connections in Connections.txt -c -r \n -SQaserver -Usa -P


    However I am getting the following error messages for three tables in my db:

    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
    Error = [Microsoft][ODBC SQL Server Driver]String data, right truncation
    SQLState = 22001, NativeError = 0
    Error = [Microsoft][ODBC SQL Server Driver]String data, right truncation

    0 rows copied.

    Please note that the design for the source and target tables is the same. Here is the table design for one of the tables:

    CONNECTIONID varchar 8
    DESCRIPTION varchar 50
    RASENTRYNAME varchar 50
    NETUSEDRIVE char 10
    CONNECTIONTYPE int 4
    STATUS char
    RAS_USERID varchar 16
    RAS_PASSWORD varchar 16


    Any help would be appriciated.
    Thanks,
    -Meghna.

  2. #2
    Join Date
    Feb 2002
    Posts
    2,232
    Can you attach the file you are trying to import or a sample of the records ?

  3. #3
    Join Date
    Nov 2002
    Posts
    3
    Originally posted by rnealejr
    Can you attach the file you are trying to import or a sample of the records ?
    Here is the sample record for table connections:

    Session4 Wan Connection 4 N/A 3 A
    Session3 Wan Connection 3 N/A 3 A
    Session2 Wan Connection 2 N/A 3 A
    Session1 Wan Connection 1 N/A 3 B
    Session5 Wan Connection 5 N/A 3 A
    Session7 Wan Connection 7 N/A 3 A
    Session6 Wan Connection 6 N/A 3 A
    Session8 Wan Connection 8 N/A 3 A

  4. #4
    Join Date
    Feb 2002
    Posts
    2,232
    Which field is N/A being applied to ?

  5. #5
    Join Date
    Feb 2002
    Posts
    2,232
    What are the potential values for the first field "SessionX" ? Also, just take the first line from the file and use that line to test.

  6. #6
    Join Date
    Nov 2002
    Posts
    3
    Originally posted by rnealejr
    Which field is N/A being applied to ?
    N/A applies to rasEntryName. I also tried with only one row , I get the following:

    Network packet size (bytes): 4096
    Clock Time (ms.): total 15

    Starting copy...
    SQLState = S1000, NativeError = 0
    Error = [Microsoft][ODBC SQL Server Driver]Unexpected EOF encountered in BCP data-file



    When tried with two rows, I get the following:

    Network packet size (bytes): 4096
    Clock Time (ms.): total 1

    Starting copy...
    SQLState = 22001, NativeError = 0
    Error = [Microsoft][ODBC SQL Server Driver]String data, right truncation
    SQLState = S1000, NativeError = 0
    Error = [Microsoft][ODBC SQL Server Driver]Unexpected EOF encountered in BCP data-file

  7. #7
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    809
    What is your column seperator in your data file? Since you did not specify one, "-t", it needs to be a tab "\t".

    Based on your example data, could you take one row and anotate the associated attribute? If you need to skip an attribute, you either need to provide a place holder in your data file OR use a format file, IMHO the second option works better.

    The "Unexpected EOF encountered in BCP data-file" error is probably du to the last row NOT having a "\r" at the end, open the file and do a "CTRL+END", are you at the end of a line or an empty line?

    Post back your thoughts and one of use will help.
    Paul Young
    (Knowledge is power! Get some!)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •