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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-general by date

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