0

Hello i have a Content Type that has been using a body field. Now i was wanting to use a CCK text field instead. Is there a way i can convert existing node body fields for this content type to my new cck field?

Thanks

(drupal 6)

1 Answer 1

1

Three options spring to mind:

  1. Views Bulk Operations. Safest if the amount of nodes to convert is manageable. You'll probably need to use custom PHP to make the conversion happen though, as the ready-made functionality won't cut your demands.
  2. Custom script where you load each node to be converted, modify the structure and run node_save().
  3. SQL query, either pure SQL or by custom Drupal (Drush) script. First create your content type, then see the database structure. Then select the body text from the table node_revisions and insert it into your field value column for each node.
2
  • thanks kekkis. I use VBO but i wont be able to make the custom PHP so as you can guess that makes 2 not an option either for me. Ive messed about with the db before so maybe 3 would work. I have my content type 'vids' when i look in node_revisons table there doesnt seem to be a way to sort by content type. errrr
    – Reg Gordon
    Dec 29, 2012 at 23:31
  • You have to join the node table to get the content type information: INNER JOIN node n ON nr.vid = n.vid where nr is the alias for node_revisions.
    – kekkis
    Dec 30, 2012 at 11:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.