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 report shows phone numbers found in Family Contacts that contain something other than 10 numeric values. After running this SQL, navigate to the Family Contacts section for each patient to update the invalid phone number(s): Clinical, Practice Management, or Billing tab > Patient Chart button > search for and select the patient > Family Contacts.
A sample image of this SQL report run in the Database Viewer is shown below.
SQL Code: Firebird
To highlight and copy the code below to your clipboard, simply click the Copy button.
select id, last_name, first_name, address_1, address_2 city, state, zip_code, work_phone, home_phone,cell_phone from contact where (work_phone not similar to '[0-9]{3}[-]{0,1}[0-9]{3}[-]{0,1}[0-9]{4}[ ]{0,}' and work_phone != '') or (home_phone not similar to '[0-9]{3}[-]{0,1}[0-9]{3}[-]{0,1}[0-9]{4}[ ]{0,}' and home_phone != '') or (cell_phone not similar to '[0-9]{3}[-]{0,1}[0-9]{3}[-]{0,1}[0-9]{4}[ ]{0,}' and cell_phone != '');
SQL Code: MySQL
To highlight and copy the code below to your clipboard, simply click the Copy button
select id, last_name, first_name, address_1, address_2 city, state, zip_code, work_phone, home_phone,cell_phone from contact where (work_phone not rlike '^[0-9]{3}[-]{0,1}[0-9]{3}[-]{0,1}[0-9]{4}[ ]{0,}$' and work_phone != '') or (home_phone not rlike '^[0-9]{3}[-]{0,1}[0-9]{3}[-]{0,1}[0-9]{4}[ ]{0,}$' and home_phone != '') or (cell_phone not rlike '^[0-9]{3}[-]{0,1}[0-9]{3}[-]{0,1}[0-9]{4}[ ]{0,}$' and cell_phone != '');