Skip site navigation (1) Skip section navigation (2)

Re: Cast char to number

From: Bill Moran <wmoran(at)potentialtech(dot)com>
To: Christine Penner <christine(at)ingenioussoftware(dot)com>
Cc: Postgres-General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Cast char to number
Date: 2010-02-24 19:38:47
Message-ID: 20100224143847.604d7ef2.wmoran@potentialtech.com (view raw or flat)
Thread:
Lists: pgsql-general
In response to Christine Penner <christine(at)ingenioussoftware(dot)com>:

> I have a character field I want to change to a number. The values in 
> that field are all numbers that may or may not be padded with spaces 
> or 0's. What is the best way to do that?

Put the values in numeric fields to begin with and cast to chars as
needed.  Basically reverse what you're doing.

-- 
Bill Moran
http://www.potentialtech.com
http://people.collaborativefusion.com/~wmoran/

In response to

Responses

pgsql-general by date

Next:From: Christine PennerDate: 2010-02-24 19:53:42
Subject: Re: Cast char to number
Previous:From: Christine PennerDate: 2010-02-24 19:36:14
Subject: Cast char to number

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group