I need to do a query that updates text with a line break. I tried using \n
but it inserts "\n" literally.
Example:
update table set text = "first line\nsecond line"
I want it to show that text as:
"first line
second line"
and not as "first line\nsecond line"
.
When I do this with .NET it works, but not on a stored procedure.
Does anyone know how to do this?
You just concatenate the string and insert a CHAR(13) where you want your line break.
To use "escape sequences" in a string literal you need to use an "extended" constant. You can specify the escape character by prefixing the letter E: UPDATE posts SET body = E'First Line\nSecond line.
Informix iSQL has a command " info tables; " that shows all tables.
You might, perhaps, be looking for the function 'ifx_allow_newline'.
Alternatively, following the suggestion of OMG Ponies, you might be looking for the package 'ascii' from the IIUG Software Archive. Informix now has the functions ASCII() and CHR() built-in. Note that if you have older versions of Informix (anything before 11.50 — 11.70 for CHR()
), these functions will not be available and you will need to consider the package from the IIUG archive.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With