SQL Server Performance

removing CRLF from a field

Discussion in 'General DBA Questions' started by Phthisis, May 18, 2007.

  1. Phthisis New Member

    hello all, i am exporting the results of a query to a .txt. I am having issues though in removing CRLF from said field. I am currently using the fallowing code to remove it but it is only removing half of the CRLF:

    REPLACE(cast(notes as varchar(8000)), CHAR(13) + CHAR(10), ' ')

    notes is a text data type and will not recieve manipulation unless converted from a text datatype.

    Thank you in advance
  2. satya Moderator

  3. Phthisis New Member

    Hello Satya, thank you for your reply. I changed my code to the below but it produced an error:

    REPLACE(cast(notes as varchar(8000)), '
    ', ' ') --didn't do anything and i also tried

    REPLACE(cast(notes as varchar(8000)),
    , ' ') --this produced an error

    was this the correct way to use
    ?

    I read the blog but dont understand how to apply the proposed solution.
  4. Phthisis New Member

    lol, problem solved, didn't realize that i was using UNION and didn't put the replace code in the other UNION'd queries. My bad

Share This Page