Search code examples
informixisql4gl

How to ignore or replace "carriage return" in informix 4GL


Say I have the following query:

insert into myTable values ("TEST 1 
TEST 2")

Then I'm selecting the description to output to an excel sheet:

select description from myTable

Result:

description TEST 1
TEST 2

This will result the output for the single-line description column to be split on 2 separate lines in the .xls output.

How can I resolve this so I get the entire string on 1 line.

Can we loop it through and find the carriage return and replace it? Or?

Thank you.


Solution

  • Using the "replace" clause, you can do the following:

    select replace(replace(description,chr(10),' '),chr(13),' ') from myTable
    
    • chr(10) is ASCII 10, which refers to LF (Line Feed).
    • chr(13) is ASCII 13, which refers to CR (Carriage Return).