Re: Converting to number with given format

2018-09-20 Thread Gabriel Furstenheim Milerud
Hi Ken, Thanks a lot, that's a cool idea and I think that it will cover my needs. On Thu, 20 Sep 2018 at 02:04, Ken Tanzer wrote: > On Wed, Sep 19, 2018 at 6:34 AM Gabriel Furstenheim Milerud < > furstenh...@gmail.com> wrote: > > Maybe that is not possible with numbers? To say in a format

Re: Converting to number with given format

2018-09-19 Thread Ken Tanzer
On Wed, Sep 19, 2018 at 6:34 AM Gabriel Furstenheim Milerud < furstenh...@gmail.com> wrote: Maybe that is not possible with numbers? To say in a format something like > "my numbers have comma as decimal separator and no thousands separators" or > "my numbers are point separated and have comma as

Re: Converting to number with given format

2018-09-19 Thread Tim Cross
Gabriel Furstenheim Milerud writes: > Sorry, > So basically what I'm trying to achieve is the following. There is an input > file from the user and a configuration describing what is being inserted. > For example, he might have Last activity which is '-MM-DD HH:mi:ss' and > Join date which

Re: Converting to number with given format

2018-09-19 Thread Adrian Klaver
On 9/19/18 6:33 AM, Gabriel Furstenheim Milerud wrote: Sorry, So basically what I'm trying to achieve is the following. There is an input file from the user and a configuration describing what is being inserted. For example, he might have Last activity which is '-MM-DD HH:mi:ss' and Join

Re: Converting to number with given format

2018-09-19 Thread Gabriel Furstenheim Milerud
Sorry, So basically what I'm trying to achieve is the following. There is an input file from the user and a configuration describing what is being inserted. For example, he might have Last activity which is '-MM-DD HH:mi:ss' and Join date which is only '-MM-DD' because there is no

Re: Converting to number with given format

2018-09-19 Thread Adrian Klaver
On 9/19/18 6:11 AM, Gabriel Furstenheim Milerud wrote: I'm not completely sure that that actually works SELECT to_number('9,134','9V3') =9 SELECT (to_number('9,134', '9')/1000)::numeric(4,3); numeric - 9.134 It's true when it should be false (it should be 9.134). Also it is

Re: Converting to number with given format

2018-09-19 Thread Gabriel Furstenheim Milerud
I'm not completely sure that that actually works SELECT to_number('9,134', '9V3') = 9 It's true when it should be false (it should be 9.134). Also it is completely dependent on the number of digits. So for example: SELECT to_number('19,134', '9V3') Is 1, not 19.134 or even 19 On Wed,

Re: Converting to number with given format

2018-09-19 Thread Adrian Klaver
On 9/19/18 5:38 AM, Gabriel Furstenheim Milerud wrote: Hello, I'd like to convert a string number to a number being able to provide the custom format. With dates it works perfectly fine, so that I can do: SELECT to_date('18 09 10', 'YY MM DD') Is there something similar with numbers? SELECT

Converting to number with given format

2018-09-19 Thread Gabriel Furstenheim Milerud
Hello, I'd like to convert a string number to a number being able to provide the custom format. With dates it works perfectly fine, so that I can do: SELECT to_date('18 09 10', 'YY MM DD') Is there something similar with numbers? SELECT to_number('9,000', some_format) = 9; SELECT