I created a new field called field_code_file and I transferred all the value from field_code. Reference here.

Now if I delete the old field called field_code, the value in field_code_file is also deleted. So how can I delete field_code by retaining the value in field_code_file?

BTW, not only the value that is being deleted but also the files. What I'm doing is simply restore the files from the backup. The only problem I have is to retain the value in the table, whatever table it is.

Anyone can help me, please?

1 Answer 1


I'm not sure this can help you, but one solution that I can suggest is to update your nodes (instead of directly querying the database): transfer one field values to the second one and save it then delete the first one. You can use entity_metadata_wrapper or just functions that are provided by node module. You can try something like this... Example:

$nodes = node_load_multiple(array(), array('type' => 'MY_CONTENT_TYPE'));
foreach($nodes as $node) {
  $node_wrapper = entity_metadata_wrapper('node', $node);
  $field_code = $node_wrapper->field_code->value();

Your Answer

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

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