Subject | Re: Joining two string fields |
---|---|
Author | Adam |
Post date | 2005-10-18T00:59:13Z |
--- In firebird-support@yahoogroups.com, Robert martin <rob@c...>
wrote:
said CRLF separated string. Could you please give me an example?
I just open a quote, hit enter, then close the quote
like this '
'
Just a little trick.
(DelAddress.PostCode, '')
I assume you don't want the extra carriage return if the postcode is
null. Because crlf || null is still null, the following will achieve
that.
SELECT c.ClientCode, c.ClientName, cd.Local5Flag, a.AddressTxt ||
COALESCE(a.PostCode, ''), DelAddress.AddressTxt || COALESCE('
' || DelAddress.PostCode, '')
If you wanted the additional crlf even if the postcode is null, then
SELECT c.ClientCode, c.ClientName, cd.Local5Flag, a.AddressTxt ||
COALESCE(a.PostCode, ''), DelAddress.AddressTxt || '
' || COALESCE(DelAddress.PostCode, '')
Hope that helps
Adam
wrote:
>this into my editor?
> Hi Adam
>
> In the following....
>
> select 'Hello' || '
> ' || 'World'
> from RDB$DATABASE;
>
> I assume there is a CRLF between lines 1 and 2. How do I enter
>is a stored procedure that I want to return (as one of its results)
>
> Your comment about creating a stored procedure is interesting as it
said CRLF separated string. Could you please give me an example?
I just open a quote, hit enter, then close the quote
like this '
'
Just a little trick.
>NumLabels SmallInt)
> My SP currently has ....
>
> CREATE PROCEDURE pr_Custom_POSlabel (ControlRef Numeric(11),
> /* RM 06/09/2005 produce labels from POS */|| COALESCE(a.PostCode, ''), DelAddress.AddressTxt || COALESCE
> RETURNS
> (
> ClientCode VarChar(20),
> ClientName VarChar(40),
> DelAddress varChar(254),
> PostAddress VarChar(254),
> LabelNo Integer,
> TotBoxes Integer,
> IsWholeSale Char(1)
> )
> AS
> BEGIN
> SELECT c.ClientCode, c.ClientName, cd.Local5Flag, a.AddressTxt
(DelAddress.PostCode, '')
> ......(addressTxt is a formatted field).
>
> Obviously I would like the postcodes to be on the following line
I assume you don't want the extra carriage return if the postcode is
null. Because crlf || null is still null, the following will achieve
that.
SELECT c.ClientCode, c.ClientName, cd.Local5Flag, a.AddressTxt ||
COALESCE(a.PostCode, ''), DelAddress.AddressTxt || COALESCE('
' || DelAddress.PostCode, '')
If you wanted the additional crlf even if the postcode is null, then
SELECT c.ClientCode, c.ClientName, cd.Local5Flag, a.AddressTxt ||
COALESCE(a.PostCode, ''), DelAddress.AddressTxt || '
' || COALESCE(DelAddress.PostCode, '')
Hope that helps
Adam
>wrote:
> TIA
> Rob
>
>
> Rob Martin
> Software Engineer
>
> phone +64 03 377 0495
> fax +64 03 377 0496
> web www.chreos.com
>
> Wild Software Ltd
>
>
>
> Adam wrote:
>
> >--- In firebird-support@yahoogroups.com, Robert martin <rob@c...>
> >would like
> >
> >>Hi
> >>
> >>I want to return StringA || StringB. I can do this fine but
> >>a cr between the two strings so they begin on different lines(when
> >>printed). How do I do this?
> >>
> >>
> >
> >I can imagine a number of methods, the easiest being
> >
> >select 'Hello' || '
> >' || 'World'
> >from RDB$DATABASE;
> >
> >Other methods are creating a stored procedure called crlf, (you can
> >guess what it returns).
> >
> >select 'Hello' || (select str from CRLF()) || 'World'
> >from RDB$DATABASE;
> >
> >Thirdly, you could create a UDF function called CRLF
> >
> >select 'Hello' || CRLF() || 'World'
> >from RDB$Database;
> >
> >The first way looks easiest though.
> >
> >Adam
> >
> >
> >
> >
> >
> >
> >
> >++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >
> >Visit http://firebird.sourceforge.net and click the Resources item
> >on the main (top) menu. Try Knowledgebase and FAQ links !
> >
> >Also search the knowledgebases at http://www.ibphoenix.com
> >
> >++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >
> >Yahoo! Groups Links
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
>
>
> [Non-text portions of this message have been removed]
>