Subject RE: [firebird-support] CHECK for all numeric characters
Author Rick Debay
I changed 'length' to 'strlen' and added the UDFs length and strlen.
What's transform?

-----Original Message-----
From: firebird-support@yahoogroups.com
[mailto:firebird-support@yahoogroups.com] On Behalf Of David Johnson
Sent: Thursday, September 01, 2005 1:25 PM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] CHECK for all numeric characters

On Thu, 2005-09-01 at 18:26 +0200, Ivan Prenosil wrote:
> > I'm creating a domain that's CHAR(11) and I'd like to add a check to

> > make sure all the characters are numeric. I'm experiencing a brain
> > freeze right now and can't come up with one. Can anyone suggest the

> > appropriate CHECK statement(s)?
>
> CHECK (Value BETWEEN '00000000000' AND '99999999999')
>
> Ivan
>
>

Not quite ... this will allow '0A'.

I have recently had to coerce some character columns with garbage data
into numerics in another SQL dialect. I believe that there are UDF's
that will do this task:

length(rtrim(transform(column, '0123456789', ' '))) = 0



------------------------ Yahoo! Groups Sponsor --------------------~-->
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet
Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/67folB/TM
--------------------------------------------------------------------~->

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Visit http://firebird.sourceforge.net and click the Resources item on
the main (top) menu. Try Knowledgebase and FAQ links !

Also search the knowledgebases at http://www.ibphoenix.com

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Yahoo! Groups Links