Export "Replaced" Text in DTS

  • Bit of a strange one is this... 

    I've created a DTS package that simply pulls out data from a stored procedure and writes it to a CSV file.  Works a treat!!

    However, one of the fields in the database that is being exported contains carriage returns - which i don't want.  Instead I want a line feed.

    So I change the stored procedure to return the column using:

    REPLACE( thecolumname, CHAR( 13 ), CHAR( 10 ) ) AS TheString.

    Seems ok in the SQL Query Analyzer, but looking in a hex editor, it shows as 0D 0A (13, 10 ) - which is carriage return, linefeed.

    Is this something SQL DTS does or what?  Answers on a post card.

     

  • The second agument of replace is the replacement text.

     

    I think you want

    REPLACE( REPLACE( thecolumname, CHAR( 13 ) , '' ) , CHAR( 10) , '' ) AS TheString

    ______________________________________________________________________

    Personal Motto: Why push the envelope when you can just open it?

    If you follow the direction given HERE[/url] you'll likely increase the number and quality of responses you get to your question.

    Jason L. Selburg
  • Ah cheers,

    Just needed to remove the carriage returns...

    REPLACE( Progress_Notes, CHAR( 13 ) , '' ) AS TheValue

  • Are you by any chance Paul Anderson of Pembroke, Birmingham and various locations along the Charing Cross Road?

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

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

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