Subject | Re: CORRECTION Re: [firebird-support] formatting a number |
---|---|
Author | Hans |
Post date | 2005-04-27T15:40:51Z |
Snippet:
TICKET_ID VARCHAR(10)
TICKET_NO INTEGER;
TICKET_ID = SubStr('0000000000',1,10-StrLen(TICKET_NO)) || TICKET_NO;
==========================================================
TICKET_ID VARCHAR(10)
TICKET_NO INTEGER;
TICKET_ID = SubStr('0000000000',1,10-StrLen(TICKET_NO)) || TICKET_NO;
==========================================================
----- Original Message -----
From: "Ali Gökçen" <alig@...>
To: <firebird-support@yahoogroups.com>
Sent: Wednesday, April 27, 2005 9:04 AM
Subject: CORRECTION Re: [firebird-support] formatting a number
>
>
> Hi,
> I improved my solution a little more, whenever i find a spare
> time.. :)
>
> tmp = cast(12345 as varchar(10)) || 'I love Firebird even without
> strlen! ;)';
>
> while (not substring(tmp from 10 for 1) between '0' and '9')
> tmp = '0' || tmp;
> end
>
> result = substring(tmp from 1 for 10); -- '0000012345'
>
> nevertheless, the solution posted by Helen is more clear.
> if you have too much records for this operation, like operator may
> more slow i think..
>
> Regars,
>
> Ali
>
>
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>