Subject | CORRECTION Re: [firebird-support] formatting a number |
---|---|
Author | Ali Gökçen |
Post date | 2005-04-28T07:27:31Z |
Hi Grant,
it was my fastest solution, so i didn't publish it here. ;)
try to use case, it will more clear and short.
case
when mynumber<10 then mypad = '00000000';
when mynumber<100 then mypad = '0000000';
...
and
mypaddednumber = mypad || mynumber;
anyway, if your number is BIGINT this code bores everyone.
Regards,
Ali
--- In firebird-support@yahoogroups.com, Grant Brown <grant@s...>
wrote:
it was my fastest solution, so i didn't publish it here. ;)
try to use case, it will more clear and short.
case
when mynumber<10 then mypad = '00000000';
when mynumber<100 then mypad = '0000000';
...
and
mypaddednumber = mypad || mynumber;
anyway, if your number is BIGINT this code bores everyone.
Regards,
Ali
--- In firebird-support@yahoogroups.com, Grant Brown <grant@s...>
wrote:
> Hi all,(20));
>
> The solution that I finally used was really simple
>
> /* format the new document number */
>
> if (New_No<10) then New_No_Tx = '0000'|| cast(New_No as VarChar
> else if (New_No<100) then New_No_Tx = '000'|| cast(New_No as
> VarChar(20));
> else if (New_No<1000) then New_No_Tx = '00'|| cast(New_No as
> VarChar(20));
> else if (New_No<10000) then New_No_Tx = '0'|| cast(New_No as
> VarChar(20));
> else New_No_Tx = cast(New_No as VarChar(20));
>
> works for me.
>
> --
> Regards,
> Grant Brown
>
> Product Development Manager
> Phone : 02 4229 1185
> Mobile : 0412 926 995
> Email : grant@s...
> Web : www.sitedoc.com.au
>
> SiteDoc - Easy to Use - Powerful Results