Q:

Problem converting tags to categories while having large number of tags

I'm trying to convert some tags in my website to categories, via either Wordpress import tools or Taxonomy Converter plugin. 
In both cases, I get Internal server Error, when I try to query (load) the tags, because my website is having over 20,000 tags. 
Is there a manual or MySQL query method I can use for converting?  Since my website can't just display the 20,000 tags in a single page for me to choose from. 

A:

Yes, there is a SQL-based method to do this. 
Just run this SQL (it will convert all tags to categories, if you want to convert only some of them, you have to add your conditions to WHERE clause):
UPDATE wp_term_taxonomy SET taxonomy='category' WHERE taxonomy='post_tag'

You can do this using $wpdb:
$wpdb->query( "UPDATE $wpdb->term_taxonomy SET taxonomy='category' WHERE taxonomy='post_tag'" );

