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?
TIAIt'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.|||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?|||In my case I ended up going with the view solution. What are your plans?|||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.|||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).
没有评论:
发表评论