How to Delete A Field and Retain Its Value?
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' =&gt; 'MY_CONTENT_TYPE'));
foreach($nodes as $node) {
  $node_wrapper = entity_metadata_wrapper('node', $node);
  $field_code = $node_wrapper-&gt;field_code-&gt;value();
  $node_wrapper-&gt;field_code_file-&gt;set($field_code);
  $node_wrapper-&gt;save();
}