Re: check data for datatype

From: Raymond O'Donnell <rod(at)iol(dot)ie>
To: Suresh Raja <suresh(dot)rajaabc(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Re: check data for datatype
Date: 2015-03-27 18:14:50
Message-ID: 55159E1A.3050608@iol.ie
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

On 27/03/2015 18:08, Suresh Raja wrote:
> Hi All:
>
>
> I have a very large table and the column type is text. I would like to
> convert in numeric. How can I find rows that dont have numbers. I
> would like to delete those rows.

Use a regular expression:

select <whatever> from <the table> where <the column> ~ <regexp>

http://www.postgresql.org/docs/9.4/static/functions-matching.html#FUNCTIONS-POSIX-REGEXP

HTH,

Ray.

--
Raymond O'Donnell :: Galway :: Ireland
rod(at)iol(dot)ie

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jan de Visser 2015-03-27 18:31:01 Re: Building JSON objects
Previous Message Eli Murray 2015-03-27 18:12:52 Re: Building JSON objects

Browse pgsql-sql by date

  From Date Subject
Next Message Jerry Sievers 2015-03-27 18:53:09 Re: [GENERAL] check data for datatype
Previous Message Suresh Raja 2015-03-27 18:08:43 check data for datatype