Results 1 to 4 of 4
  1. #1
    Join Date
    May 2011
    Posts
    2

    Unanswered: bcp leaving out the last column which is null while extracting from the table

    Hello All,
    I'm using BCP out utility for creating a data file in which I have kept '|' as the column delimiter and '\n' as row delimiter. My bcp command looks like :

    bcp temp_table out /dir/$FILENAME -c -Uabc -S$SERVER -P$PASSWORD -c -t "|" -r "\r\n"

    There are 7 columns in the table and i'm expecting 7 delimiters to be shown in data file. But I'm getting only 6 delimiters when I used the above command. Since the last column in NULL I'm getting such a result . I'm getting the output as :

    a|abca|hi|def|hello|1536|
    But I want as :
    a|abca|hi|def|hello|1536||

    Please help me on this

  2. #2
    Join Date
    Jun 2007
    Location
    London
    Posts
    2,527
    Quote Originally Posted by orrion View Post
    There are 7 columns in the table and i'm expecting 7 delimiters to be shown in data file.
    I think it's your expectations that are wrong! If you had 2 columns then there would be one delimiter between the first and second columns. Similarly there would be 6 separators for a table of 7 columns ie

    col1|col2|col3|col4|col5|col6|col7

  3. #3
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Mike is correct, if you have seven columns then you should only have sx column delimiters (between the columns) and one row delimiter (at the end of the row).

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  4. #4
    Join Date
    May 2011
    Posts
    2
    Thanks for ur replies ..

Posting Permissions

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