Subject | Re: [firebird-support] EOL Literals in SQL |
---|---|
Author | Helen Borrie |
Post date | 2005-03-04T00:32:34Z |
At 05:51 PM 3/03/2005 -0500, you wrote:
AsciiChar function from ib_udf.
then
.. || AsciiChar(13) || AsciiChar(10) || ...
An old hack from Bill Karwin for getting a CRLF into a literal is to
copy/paste one directly into the "space" from an editor that displays
non-printing characters. Here's one you can copy from here:
|| '
' ||
So, using the pasted literal, your string would look like this:
Update "Table" set "NewField" (
select "Name" || '
' || "City" from "Table1" where ...
You can also keep a table of pasted literals in your database and subquery
it...make it a one-row table and then you never have to worry about getting
singleton exceptions - bad relational design but a useful hack.
create table non_printable (
nullchar char(1),
lf char(1),
cr char(1),
tabchar(1),
...etc. )
./hb
>I have a blob (text) that I need to update with some data from some otherWhy not use a UDF for a one-time run? All you need to do is declare the
>fields. This is a new field in the table, and for historical purposes I need
>ot just fill in the data for existing rows. The system will populate new
>rows.
>
>I need to embed some EOLs though. So something like
>
>Update "Table" set "NewField" (
> select "Name" + EOL + "City" from "Table1" where ...
>)
>
>Any idea how I can get an EOL literal in SQL? This is a one time run, so I
>don't want to use a UDF, etc.
AsciiChar function from ib_udf.
then
.. || AsciiChar(13) || AsciiChar(10) || ...
An old hack from Bill Karwin for getting a CRLF into a literal is to
copy/paste one directly into the "space" from an editor that displays
non-printing characters. Here's one you can copy from here:
|| '
' ||
So, using the pasted literal, your string would look like this:
Update "Table" set "NewField" (
select "Name" || '
' || "City" from "Table1" where ...
You can also keep a table of pasted literals in your database and subquery
it...make it a one-row table and then you never have to worry about getting
singleton exceptions - bad relational design but a useful hack.
create table non_printable (
nullchar char(1),
lf char(1),
cr char(1),
tabchar(1),
...etc. )
./hb