Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
1  
Um ... WordPress runs on MySQL ... anything with MS SQL would require an entirely separate server architecture ... and that doesn't even touch sitemaps, which deal with the pages of your site, which would come from WordPress' MySQL database ... so what exactly are you asking? –  EAMann Sep 21 '10 at 19:06
    
Please clarify? WordPress works with database through its API functions ($wpdb). Any plugin that properly uses API should work, even if you are running WordPress customized to run on non-default database engine. –  Rarst Sep 21 '10 at 19:14
    
Please specify the Wordpress Derivate you use for MSSQL support (a derivate is everything from a smaller Add-On to a patch or a complete Fork). Just provide the URL from where you downloaded Wordpress with MSSQL if you don't understand what I mean. –  hakre Sep 21 '10 at 22:12
add comment

1 Answer

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.