How to add role selection field to the registration form? How can I add the role to registration form that users can choose their role?

I tested the Profile2 module and the Auto Assign Role module but they don't do what I want.

I want to add a CCK field in the admin/configure/account/fields.

Is there any module to add a CCK field to registration form for choosing the role?
If any module doesn't fit yoour requirement then you can use the  below code
 You can create any custom module or put this code in template.php of your theme.
 function testing_custom_form_alter(&amp;$form, $form_state, $form_id){

if($form_id=="user_register_form"){
    $result = db_select('role', 'r')
                -&gt;fields('r',array('rid','name'))
                -&gt;condition('name',array('administrator','anonymous user'),'NOT IN')
                -&gt;execute()
                -&gt;fetchAll();
    $role   =   array();
    foreach($result as $userRole){

        $role[$userRole-&gt;rid] = $userRole-&gt;name;
    }

$form['role']['#type'] = "select";
$form['role']['#options'] =$role;
$form['role']['#required'] = 1;
$form['role']['#size']='auto';
    $form['#submit'][] = 'custom_assign_role';

} 

}


function custom_assign_role(&amp;$form, $form_state){
   $uid=  $form_state['values']['uid'];

    user_multiple_role_edit(array($uid), 'add_role', $form_state['values']['role']);

}

Hope it will help!