SQL: Invalid Phone Fields: Active Payers Only

There are two versions of this SQL: Firebird and MySQL. The MySQL version only applies to clients who are have migrated to MySQL.. All other Practices should continue to use the Firebird version of this code. Click to expand and copy the code you need. If you are unsure which code to use, please check with your Practice Administrator.

About

This SQL identifies malformed phone numbers in active payer records.  Malformed phone numbers are those that are not exactly 10 numeric digits. 

SQL Code: Firebird

To highlight and copy the code below to your clipboard, simply click the Copy button.

select  carrier_id ,ins_carrier_code ,ins_carrier_name ,ins_fullname ,address ,address_2 ,
city ,state ,zip, contact_phone
from ins_carrier where
(contact_phone not similar to  '[0-9]{3}[-]{0,1}[0-9]{3}[-]{0,1}[0-9]{4}[ ]{0,}' and contact_phone != '') and archive_flag <> '1';

SQL Code: MySQL

To highlight and copy the code below to your clipboard, simply click the Copy button.

select  carrier_id ,ins_carrier_code ,ins_carrier_name ,ins_fullname ,address ,address_2 ,
city ,state ,zip, contact_phone
from ins_carrier where
(contact_phone not similar to  '[0-9]{3}[-]{0,1}[0-9]{3}[-]{0,1}[0-9]{4}[ ]{0,}' and contact_phone != '') and archive_flag <> '1';