Re: converting string value to integer

From: Ken Guest <kguest(at)stockbyte(dot)com>
To: Manfred Koizar <mkoi-pg(at)aon(dot)at>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: converting string value to integer
Date: 2002-12-18 13:51:28
Message-ID: 3E007D60.8080005@stockbyte.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Manfred Koizar wrote:

>On Wed, 18 Dec 2002 11:13:50 +0000, Ken Guest <kguest(at)stockbyte(dot)com>
>wrote:
>
>
>>How do I cast/convert a string value to an integer in 7.1.3?
>>I've tried using cast but it doesn't seem to work.
>>
>>
>
><snip>
>
>
>Does this answer your question? If not, show us an example of what
>you have tried.
>
It does indeed. There were some trailing spaces which I was unaware of,
so I'm now using something akin to
SELECT CAST(TRIM('123 ') AS INT);

which works perfectly.

Thank you Manfred,

ken

________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service. For more information on a proactive anti-virus service working
around the clock, around the globe, visit http://www.messagelabs.com
________________________________________________________________________

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Masaru Sugawara 2002-12-18 14:46:24 Re: SELECT EXTRACT doesn't work with variables?
Previous Message Manfred Koizar 2002-12-18 13:30:36 Re: converting string value to integer