Treating string field as numeric to use as an exposed filter
Excellent question!
You only need the hook_views_query_alter function, here is what it should look like:

function MY_MODULE_views_query_alter(&amp;$view, &amp;$query) {
  if ( $view-&gt;name == 'manage_users' ) {

    // For filtering
    foreach($query-&gt;where[1]['conditions'] as $key =&gt; $condition) {
      if ( $condition['field'] == 'field_data_field_count.field_count_value' ) {
        $query-&gt;where[1]['conditions'][$key]['value'] = array(':val' =&gt; (int)$query-&gt;where[1]['conditions'][$key]['value']); 
        $query-&gt;where[1]['conditions'][$key]['field'] = 'CAST(' . $query-&gt;where[1]['conditions'][$key]['field'] . ' AS UNSIGNED) &gt;= :val';
        $query-&gt;where[1]['conditions'][$key]['operator'] = 'formula';
        break; 
      }
    }

    // For sorting as well
    foreach($query-&gt;orderby as $key =&gt; $condition) {
      if ( $condition['field'] == 'field_data_field_count_field_count_value' ) {                
        $query-&gt;orderby[$key]['field'] = 'CAST(' . $query-&gt;orderby[$key]['field'] . ' AS UNSIGNED)'; 
        break; 
      }
    }
  }
}


Most important parts in this code snippet:


Using CAST to change the varchar into an integer [doc]
Using the 'formula' operator to instruct views that you are using a complex SQL expression, check the source code of add_where_expression!  [doc]


Good luck!



Update Note: Even though this is working fine, the more elegant/readable way would be to have a function (equivalent to add_where_expression) that would allow overwriting a where/having condition.