WordPress Sitemap for MSSQL

Does anyone know a proper sitemap plugin for WordPress that works with MS Sql?

Here is the error I get:

Array ( 
    [0] = Array ( 
        [0] = 42000 
        [SQLSTATE] = 42000 
        [1] = 402 
        [code] = 402 
        [2] = [Microsoft][SQL Server Native Client 10.0][SQL Server]The data types text and varchar are incompatible in the equal to operator. 
        [message] = [Microsoft][SQL Server Native Client 10.0][SQL Server]The data types text and varchar are incompatible in the equal to operator. 
    ) 
) 
WordPress database error: [1]
SELECT post_id FROM wp_postmeta, wp_posts WHERE ID = post_id AND meta_key = '_wp_old_slug' AND meta_value='sitemap'

I get this error with Google XML Sitemaps plugin.... any ideas?

Topic microsoft seo plugins Wordpress

Category Web


When I look at your error message, I get the impression that you're running WordPress off a MS SQL database rather than a MySQL database. That's fine, but it makes things a bit tricky from a support perspective because the two database platforms are, in fact, different.

For example, the error message you're getting is stating that the text and varchar datatypes are incompatible, yet the SQL statement the plug-in is trying to run is using an equality operator.

Basically, the meta_key and meta_value fields are text datatypes but the values you're matching against (_wp_old_slug and sitemap) are varchar. You can't use a simple equality operator to check if they're similar.

Considering that this is a problem you'll face with just about any plug-in that accesses the WP database directly, I am going to recommend in the strongest possible terms that you migrate your site to a MySQL setup. MySQL is free, and if you're already running PHP on your server you should be able to run MySQL as well.

However, you could rewrite the portion of the plugin that makes the database call to cast your search strings at text:

SELECT post_id FROM wp_postmeta, wp_posts WHERE ID = post_id AND meta_key = CAST('_wp_old_slug' AS text) AND meta_value=CAST('sitemap' AS text)

Please note that dynamically recasting variable types in SQL statements is not my strong point and you should test this solution against a development system before deploying it in a production environment. I offer no guarantees!

As for an alternative plugin that will work in a MS SQL environment, I can offer no suggestions. Any plugin runs the risk of interacting with the database directly (i.e. trying to run a query on the database without passing it through the $wpdb abstraction layer). So unless you want to hire a developer to look through the code first, or just learn by trial and error which plugins will work, then you're generally out of luck.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.