Thread: Converting VARCHAR to DECIMAL or NUMERIC

Converting VARCHAR to DECIMAL or NUMERIC

From
Juan Francisco Diaz
Date:
The subject says it all... How can that be done? I tried to do an explicit
cast but... Id dint work.

JuanF
(A newbie in evolution!)


Re: Converting VARCHAR to DECIMAL or NUMERIC

From
Stephan Szabo
Date:
On Mon, 25 Aug 2003, Juan Francisco Diaz wrote:

> The subject says it all... How can that be done? I tried to do an explicit
> cast but... Id dint work.

I think currently you'll need to convert to text first, so something like:
cast(cast(varcharcol as text) as numeric) because there's no
varchar->numeric direct cast (although I'm not sure if an explicit cast
would be bad for those cases that text has currently that varchar doesn't)