Re: Number formatting

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: Number formatting
Дата
Msg-id 20060610182823.GA91044@winnie.fuhr.org
обсуждение исходный текст
Ответ на Number formatting  (Andy Shellam <andy@andycc.net>)
Ответы Re: Number formatting  (Andy Shellam <andy@andycc.net>)
Список pgsql-admin
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)

--
Michael Fuhr

В списке pgsql-admin по дате отправления:

Предыдущее
От: "Marc G. Fournier"
Дата:
Сообщение: How are ppl monitoring PostgreSQL ... ? What is being monitored ... ?
Следующее
От: Andy Shellam
Дата:
Сообщение: Re: How are ppl monitoring PostgreSQL ... ? What is being