From: Andy Shellam <andy@andycc.net>
To: Michael Fuhr <mike@fuhr.org>
Cc: pgsql-admin@postgresql.org
Subject: Re: Number formatting
Date: Sat, 10 Jun 2006 19:32:46 +0100
Message-ID: <448B104E.7060106@andycc.net> (raw)
In-Reply-To: <20060610182823.GA91044@winnie.fuhr.org>
References: <448B0C26.8070007@andycc.net>
<20060610182823.GA91044@winnie.fuhr.org>
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-DATETI...
>
> test=> SELECT 'INV' || to_char(123, 'FM0000000');
> ?column?
> ------------
> INV0000123
> (1 row)
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: andy@andycc.net, mike@fuhr.org
Subject: Re: Number formatting
In-Reply-To: <448B104E.7060106@andycc.net>
References: <448B0C26.8070007@andycc.net> <20060610182823.GA91044@winnie.fuhr.org> <448B104E.7060106@andycc.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox