Removing Paragraph marks in an export

  • Hi all

    I need some help please

    I am trying to remove the pragraph marks ^p in a text field called - advert.DescriptionDetails

    when creating an export to a csv file from SQL Server using DTS driven from a query

    I have successfully used RTRIM to remove trailing spaces - but also want to remove the embedded paragraph marks

    The SQL is as follows - (abridged)~

    SELECT advert.AdvertID AS VehicleID, RTRIM(advert.DescriptionDetails) AS Description,

    advert.SellingPrice AS Price, RTRIM(owner.County) AS County, RTRIM(owner.Postcode) etc.......

    FROM  ~removed

    WHERE ~ removed

    GO

    Best reagrds

    Mark

  • Mark - try this:

    SELECT advert.AdvertID AS VehicleID,

    RTRIM(REPLACE(advert.DescriptionDetails, '^P', '')) AS Description,

    advert.SellingPrice AS Price,

    RTRIM(owner.County) AS County,

    RTRIM(owner.Postcode) etc.......

    FROM ~removed

    WHERE ~ removed







    **ASCII stupid question, get a stupid ANSI !!!**

  • Hi sushila

    many thanks for the help

     I can get it to work with the code below but '^P' does not seem to work, not sure why.

    RTRIM(REPLACE(advert.DescriptionDetails,char(10), '')) AS Description

    Thanks again

    Mark

  • Mark - you can get it to work with char(10) because char(10) is ascii linefeed whereas '^p' is a literal string that is shown as a graphical representation to indicate that there is a paragraph break at that point in the text field.

    In all likelihood char(13) should work too - !







    **ASCII stupid question, get a stupid ANSI !!!**

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply