Search Postgresql Archives

Re: Extra space when converting number with to_char

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/26/12 11:50, Samuel Gilbert wrote:
> 
>    (SELECT to_char(42, '000000000') AS string) AS example;
> 
>    string   | length | showthemtome 
> ------------+--------+--------------
>   000000042 |     10 | " 000000042"

Sign padding.  Try using:
   select to_char(42, 'FM000000000') ...

To see why, look here:
http://www.postgresql.org/docs/9.2/static/functions-formatting.html#FUNCTIONS-FORMATTING-NUMERICMOD-TABLE

HTH

Bosco.


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux