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

Re: Checking for a number

From: Osvaldo Rosario Kussama <osvaldo_kussama(at)yahoo(dot)com(dot)br>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Checking for a number
Date: 2007-06-27 21:14:59
Message-ID: 4682D353.3010403@yahoo.com.br (view raw or flat)
Thread:
Lists: pgsql-general
Warren escreveu:
> I need to check if the last two characters of a field are a number. I am 
> trying something like this but it does not want to work.
> 
> substring(TRIM(field8) from '..$') SIMILAR TO '\d\d'
> 
> How should I do this?
> 

Try:
SELECT your_field ~ '.*[[:digit:]]{2}$';

Osvaldo


In response to

Responses

pgsql-general by date

Next:From: Richard Broersma JrDate: 2007-06-27 21:17:48
Subject: Re: Checking for a number
Previous:From: Andrej Ricnik-BayDate: 2007-06-27 21:11:11
Subject: Re: postgres and webmin

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