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 the Address Book that contain something other than 10 numeric values. After running this SQL, navigate to the Address Book for each contact to update their phone number(s): Clinical or Practice Management tab > Address Book > select contact.
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 addr_id ,fname,lname, company, address, city, state, zip, hphone, bphone1, bphone2 from addressbook where (hphone not similar to '[0-9]{3}[-]{0,1}[0-9]{3}[-]{0,1}[0-9]{4}[ ]{0,}' and hphone != '') or (bphone1 not similar to '[0-9]{3}[-]{0,1}[0-9]{3}[-]{0,1}[0-9]{4}[ ]{0,}' and bphone1 != '') or (bphone2 not similar to '[0-9]{3}[-]{0,1}[0-9]{3}[-]{0,1}[0-9]{4}[ ]{0,}' and bphone2 != '');
SQL Code: MySQL
To highlight and copy the code below to your clipboard, simply click the Copy button.
select addr_id ,fname,lname, company, address, city, state, zip, hphone, bphone1, bphone2 from addressbook where (hphone not rlike '^[0-9]{3}[-]{0,1}[0-9]{3}[-]{0,1}[0-9]{4}[ ]{0,}$' and hphone != '') or (bphone1 not rlike '^[0-9]{3}[-]{0,1}[0-9]{3}[-]{0,1}[0-9]{4}[ ]{0,}$' and bphone1 != '') or (bphone2 not rlike '^[0-9]{3}[-]{0,1}[0-9]{3}[-]{0,1}[0-9]{4}[ ]{0,}$' and bphone2 != '');