Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2007

    Unanswered: Data format in extracted csv file

    I am using bcp in ms sql to extract data from a view .One of the field in my view has data with carriage return key and hence the output csv file is not in format as expected. can any body let me know any way to replace this return key in the text data by some char and get the entire data in one line.

    and if possible will have to use mssql select query for the view and not a procedure.


  2. #2
    Join Date
    Nov 2003
    declare @text varchar(200)
    select @text='This is a test of replacing carriage returns.
    Did it work?
    If this is all on one line, then it did.
    select replace(replace(@text,char(10),''),char(13),' ')
    Note - this assumes the control character is actually CRLF. If it's just one or the other you may have to adjust accordingly.
    Last edited by onansalad; 07-07-11 at 13:19. Reason: forgot code tag
    Kit Lemmonds

Posting Permissions

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