How do I rename a field name of a table? I need to rename one of my fields in a table via a .install file. How can I to do this ?

Let us consider I have a table called "register" and field name called "fname". Now I need to change the field name "fname" to "name". How can I do this using a .install file?

We can add a field for a table using the below syntax :

db_add_field($ret, 'table_name', 'field_name', array('type' =&gt; 'varchar',
             'length' =&gt; 255, 'not null' =&gt; TRUE,));


What is the syntax for doing a field rename?
Using db_change_field.

Under the parameter section:


  $field Name of the field to change.
  
  $field_new New name for the field (set to the same as $field if you
  don't want to change the name).