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 »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Moving Prefixes, help with SQL?
Pages: [1]

Author Topic: Moving Prefixes, help with SQL?  (Read 533 times)

cognoscento

  • I post occasionally
  • **
  • Posts: 44
  • Karma: 1
  • CiviCRM version: 4.2
  • CMS version: Drupal 7.17
  • MySQL version: 5.1.65
  • PHP version: 5.3.17
Moving Prefixes, help with SQL?
January 05, 2011, 11:28:30 am
Background: Our organization has a significant number of members who are police officers and so want to include their rank prefix in some correspondance. Unfortunately, we realized too late that we didn't want to include it in the individual's prefix field but instead in a custom alphanumeric field called "rank". I've set up the new field, where the value is the appropriate prefix ("Sgt.") and the label is "Sergeant", but am hoping someone can help me craft an appropriate SQL statement to move certain prefixes over. (But not all the prefixes, because Mr/Ms/Mrs/Dr/Hon/etc should stay where they are...

So, a few questions:

1) What's the best way to set up this "rank" field? The way I did it, or as a numeric field with an associated option group that keeps the same option IDs? It'll only have a limited number of unique ranks in it.

2) I'm hardly lazy, but recognize that someone out there could probably craft an appropriate sql "update" statement to do the transfer quick-like-bunny, while figuring out the syntax myself would take me all day. Anyone able to help me?

Thanks in advance!

Chris.


Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Moving Prefixes, help with SQL?
January 05, 2011, 11:43:05 am
1) Sounds reasonable, what you did.

2) Yes, an SQL query can be written. Not certain if a bunny is the best candidate for the job, but a developer could do it. :)

But he would need to examine your database to determine the precise table and field names, because we can't know how your custom data is defined.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

cognoscento

  • I post occasionally
  • **
  • Posts: 44
  • Karma: 1
  • CiviCRM version: 4.2
  • CMS version: Drupal 7.17
  • MySQL version: 5.1.65
  • PHP version: 5.3.17
Re: Moving Prefixes, help with SQL?
January 05, 2011, 09:38:54 pm
What information could I provide, specifically, in case someone could write a SQL update query for me? I'm not above bribery or begging... heh. :)

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Moving Prefixes, help with SQL?
January 06, 2011, 06:19:07 am
Contact me offline if you want. I would need to see at least your SQL schema and best would be to see the entire database.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Moving Prefixes, help with SQL?

This forum was archived on 2017-11-26.