Subject Re: CHECK for all numeric characters
Author Adam
--- 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