Subject Re: [firebird-support] Newlines etc. in string literals
Author Helen Borrie
At 12:09 PM 7/08/2003 +0000, you wrote:
>I've been trying in vain to find a way to insert a string containing
>newlines into a varchar field with a plain SQL script (it's
>generated, can't use parameters here).
>Obviously I first tried things along the lines of 'some\r\ntext' but
>that doesn't seem to work.
>What does work is to really break the line in the script, but that
>confuses the C preprocessor I use to do some macro expansions on the
>script :-( Also, I'm looking for something more generic.
>I have to admit that I've always disliked how SQL uses it's own
>conventions instead of those well known from C, shell etc. when it
>comes to special characters ('' instead of \', % instead of *, _
>instead of ?), but oh well...
>Back to the point. Is there any way to escape an arbitrary character
>in a string literal, just like \r\n\e\xff\040 in C-like languages?

Nope. SQL is supposed to be host-language neutral, though I do bleed for
your poor old C programmers who cannot bear to waste bytes willingly...

Have you tried concatenating it into your string literal using the UDF

update atable
set funnychars = 'blah'||ascii_char(13)||ascii_char(10)||'blah'