>>>Hi everybody,
>>>
>>>We have a phone field, which can contain phone, can be empty or can contain words "Do not call". However, these words could be changed. My original SQL was not inlist(PHONE, space(12),'Do not call'). Obviously, this would not work, if these words are going to change. So, I need to check, if I have at least one digit in a PHONE field. I'm thinking, what would be the best way of doing it in SQL. We don't have index on PHONE field, so it probably not that important...
>>>
>>>Thanks a lot in advance.
>>
>>ISDIGIT(PHONE) should work in this case assuming that only valid phone # can start with digit.
>
>Right, but I need to re-check the requirement. May phones starting with letters qualify?
>
>I was thinking the same, as Daniel suggested, but I'm not sure, it's the best way (checking LEN())
You confused me. My assumptions are:
- The phone # cannot start with letter, at least in the properly design application.
- You don't have to validate phone # just to check if it phone # or it's not.
- If it's not a phone # than the first character in the phone field wouldn't be a digit.
If my assumptions're correct than ISDIGIT() would work. In case if you would have an index on phone field you could use expression like 'phone in ("1", "2", ..., "0")' to use Rushmore.
--sb--