Results 1 to 6 of 6

Thread: BCP question

  1. #1
    Join Date
    Aug 2003
    Location
    Andover, MA
    Posts
    256

    Unanswered: BCP question

    I am outputting table data to a file using bcp. The table consists of all CHAR datatypes, so that the output will be fixed length. The problem is that occationally a line will wrap on me. it isn't a line-lenght issue as far as I can tell, and the wrapping is occuring in the middle of the line.

    My other fils come out without a hitch.

    Anyone have any ideas?

    TIA
    -bpd

  2. #2
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    It's most likely an embedded carriage return/line feed (char(13)+char(10) or either one of the above.) In order to avoid this situation you need to either fix the data with an update by replacing char(13)+char(10) with a space (' ') or create a view that selects fields individually and passes the suspected field to a function that returns the corrected value by replacing those characters with a space.

  3. #3
    Join Date
    Aug 2003
    Location
    Andover, MA
    Posts
    256
    Funny, I was just playing with that, and it turned out to be the case. No idea how the CR/LF got in there, as I actually typed the data into the VARCHAR field myself, using Enterprise Manager.

    Oh, well. Without these little mysteries, how would I ever support my ulcers?
    -bpd

  4. #4
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    In my case I ended up going with the view solution. What are your plans?

  5. #5
    Join Date
    Aug 2003
    Location
    Andover, MA
    Posts
    256
    The table I am reading from simply holds parameters for SAP files. It is a small table that will be maintained manually, so I will just control the input.
    -bpd

  6. #6
    Join Date
    Aug 2003
    Location
    Andover, MA
    Posts
    256
    I am running bcp from within a stored procedure, so I suppose I could use REPLACE on the parameter values to exclude and CR/LF values (just to be safe).
    -bpd

Posting Permissions

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