Subject | RE: CORRECTION Re: [firebird-support] formatting a number |
---|---|
Author | Alan McDonald |
Post date | 2005-04-28T00:22:11Z |
> Hi all,simple yet ugly...
>
> 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(20));
> 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
when one line will do it
select f_padleft(FIELDNAME, '0', 20) from table
Alan