From: | Andy Shellam <andy(at)andycc(dot)net> |
---|---|
To: | Michael Fuhr <mike(at)fuhr(dot)org> |
Cc: | pgsql-admin(at)postgresql(dot)org |
Subject: | Re: Number formatting |
Date: | 2006-06-10 18:32:46 |
Message-ID: | 448B104E.7060106@andycc.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
Perfect
Thanks Michael :-)
Andy
Michael Fuhr wrote:
> On Sat, Jun 10, 2006 at 07:15:02PM +0100, Andy Shellam wrote:
>> So, what I'm trying to do is use a primary key to generate invoice
>> numbers such as "INV0000001", "INV0000002" etc. Obviously a sequence
>> generates the increments, but when I try formatting it, it adds a space
>> at the beginning of the number.
>
> The FM modifier suppresses padding spaces.
>
> http://www.postgresql.org/docs/8.1/interactive/functions-formatting.html#FUNCTIONS-FORMATTING-DATETIMEMOD-TABLE
>
> test=> SELECT 'INV' || to_char(123, 'FM0000000');
> ?column?
> ------------
> INV0000123
> (1 row)
>
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Fuhr | 2006-06-10 19:06:53 | Re: How are ppl monitoring PostgreSQL ... ? What is being |
Previous Message | Jeff Frost | 2006-06-10 18:30:08 | Re: pg_dumpall 8.1.4 large objects error |