Subject RE: [firebird-support] Re: CHECK for all numeric characters
Author Rick Debay
CAST(VALUE AS BIGINT) BETWEEN 0 AND 99999999999

Worked great, thanks.

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

--- In firebird-support@yahoogroups.com, "Rick Debay" <rdebay@r...>
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)?
>
> Thanks, Rick DeBay

Hi Rick,

Already a lot of responses, and certainly the numeric(11,0) should be
one you consider.

But if you want varchar, then can't you use

Check(Cast(Value as BigInt) between x and y)

(Substitute X and Y for the smallest largest legal values, I don't know
if you allow negatives. Also BigInt may need to be numeric(a,b)
depending on whether in your mind a decimal point is a valid character
in this field).

Hope that helps
Adam






------------------------ Yahoo! Groups Sponsor --------------------~-->
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/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