Subject Re: [firebird-support] formatting a number
Author Helen Borrie
At 03:38 PM 27/04/2005 +1000, you wrote:

>Hi all,
>
>In FB1.5 how can I format a number into a string with a fixed number of
>leading zeros inside of a stored procedure ?
>
>for example if the number is 10 then after formatting it would be a
>string with a value of 0000010

Try this little trick (credits to Dmitry Sibiryakov):

PADDED_STRING = CAST(YourInteger AS STRING(10));
WHILE (NOT (PADDED_STRING LIKE '__________%'))
DO
ID_AS_STRING = '0'||ID_AS_STRING;

/* :-)) */

./heLen