CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • Postal code cleanup, for Canadian users
Pages: [1]

Author Topic: Postal code cleanup, for Canadian users  (Read 1040 times)

wftl

  • I’m new here
  • *
  • Posts: 28
  • Karma: 4
    • Writer and Free Thinker at Large
Postal code cleanup, for Canadian users
July 13, 2009, 08:04:52 am
Hello everyone,

Thought I'd post a solution to a problem we were having. Postal codes have a format of "A9A9A9" but were sometimes entered as "A9A 9A9" or "a9A-9A9" and various combinations of upper case, lower case, hyphens, and no hyphens. This made searches based on postal codes a little difficult. So I did some database cleanup. In case this might be useful to someone else, here's what I did.

To clean up spaces:

   update civicrm_address set postal_code = replace(postal_code," ","");

To clean up hyphens:

   update civicrm_address set postal_code = replace(postal_code,"-","");

To make it all upper case:

   update civicrm_address set postal_code = ucase(postal_code);

Enjoy, and take care out there.

--
Marcel (Writer and Free Thinker at Large) Gagné
Note: This massagee wos nat speel or gramer-checkered.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • Postal code cleanup, for Canadian users

This forum was archived on 2017-11-26.