Subject Re: stripping phone numbers
Author Adam
--- In, "tdmfguru" <hanwel@t...> wrote:
> Hi,
> I would like to strip phone numbers (with a trigger after insert in a
> second field) so I get only the raw numbers in the second field. Any
> nondigits should be stripped.
> Example: +49/6849-22415 should give 49684922415.
> Is there any posibility to solve this without creating a UDF?
> Thanks in advance for any ideas.
> Hanno Welsch

Some ideas

You can create a stored procedure instead of a UDF call. The substring
call can be used to read a string character by character. You can
attempt to cast each character as an integer. If that raises an
exception, skip to the next character, otherwise add it to the output
string. You could use a BIGINT to store the RAW phone number once it
has been extracted.