Subject | Re: [firebird-support] Concaten8ing columns |
---|---|
Author | Hans |
Post date | 2005-05-05T22:56:34Z |
with the Firebird supplied UDF library a simple
TICKET_NO Integer;
TICKET_ID VarChar(6);
TICKET_ID = SubStr('000000',1,6-StrLen(TICKET_NO)) || TICKET_NO;
works great to always produce '000024' if TICKET_NO = 24
-------------------------------------------------------------------------------
TICKET_NO Integer;
TICKET_ID VarChar(6);
TICKET_ID = SubStr('000000',1,6-StrLen(TICKET_NO)) || TICKET_NO;
works great to always produce '000024' if TICKET_NO = 24
-------------------------------------------------------------------------------
----- Original Message -----
From: "Clay Shannon" <cshannon@...>
To: <firebird-support@yahoogroups.com>
Sent: Thursday, May 05, 2005 3:47 PM
Subject: RE: [firebird-support] Concaten8ing columns
> <<CAST('0' || substring(A.UNIT_ID from 1 for 1) ||'-'|| A.ADMISSION_ID
> ||'-0'|| A.ADMIT_ORDINAL AS VARCHAR(16)),>>
>
> OK, that worked great. Now I need to know how I can append 2 zeros if a
> value is 1..9, but only one zero if it is 10..99. I have:
>
> CAST(''0'' || substring(A.UNIT_ID from 1 for 1)||''-''|| A.ADMISSION_ID
> ||''-0''|| A.ADMIT_ORDINAL AS VARCHAR(16)), ')
>
> But need the last '0' to be two '00s if A.ADMIT_ORDINAL is < 10.
>
> Clay Shannon,
> Dimension 4 Software
>
>
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> 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
>
>
>
>
>
>
>