Re: How to convert string to integer

From: Szymon Guz <mabewlun(at)gmail(dot)com>
To: venkat <ven(dot)tammineni(at)gmail(dot)com>
Cc: Postgres General <pgsql-general(at)postgresql(dot)org>, pgsql-sql(at)postgresql(dot)org
Subject: Re: How to convert string to integer
Date: 2010-12-15 10:27:37
Message-ID: AANLkTi==xC9HKA6RrxK9YtmdBQ3F2Q6W19xR3rL84p9u@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

On 15 December 2010 11:23, venkat <ven(dot)tammineni(at)gmail(dot)com> wrote:

> Dear All,
>
> How do i convert string to int
>
> select SUM(pan_1) from customers1 where name='101'
>
> When i run the above query i m getting "function sum(character varying)
> does not exist"..
>
> Please anyone can guide me..
>
> Thanks
>
>
>
select SUM(pan_1::integer) from customers1 where name='101'

but this will work only if for all rows you can convert this field to
integer

regards
Szymon Guz

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2010-12-15 10:27:50 Re: [SQL] How to convert string to integer
Previous Message venkat 2010-12-15 10:23:32 How to convert string to integer

Browse pgsql-sql by date

  From Date Subject
Next Message Pavel Stehule 2010-12-15 10:27:50 Re: [SQL] How to convert string to integer
Previous Message venkat 2010-12-15 10:23:32 How to convert string to integer