Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

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)

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

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.
share|improve this answer
    
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 '12 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 '12 at 11:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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