WordPress.org

Ready to get started?Download WordPress

Forums

WP Db Abstraction
Database Update Issues (4 posts)

  1. shaythai
    Member
    Posted 2 years ago #

    When upgrading the database after the move to 3.4 I got this error:

    WordPress database error: [[Microsoft][SQL Server Native Client 11.0][SQL Server]Incorrect syntax near ')'.]
    ALTER TABLE wp_sp_blogterms ADD );

    WordPress database error: [[Microsoft][SQL Server Native Client 11.0][SQL Server]Incorrect syntax near ')'.]
    ALTER TABLE wp_sp_blogterm_taxonomy ADD );

    WordPress database error: [[Microsoft][SQL Server Native Client 11.0][SQL Server]Incorrect syntax near ')'.]
    ALTER TABLE wp_sp_blogoptions ADD CONSTRAINT [_option_name] UNIQUE NONCLUSTERED (option_name) );

    Also getting an 500 Internal Server error when trying to go to the Dashboard. Plus this error when getting to various areas of the admin areas:

    WordPress database error: [[Microsoft][SQL Server Native Client 11.0][SQL Server]Incorrect syntax near the keyword 'LIKE'.]
    SELECT COUNT(NULLIF(meta_value LIKE '%"administrator"%', false) as Computed), COUNT(NULLIF(meta_value LIKE '%"editor"%', false) as Computed), COUNT(NULLIF(meta_value LIKE '%"author"%', false) as Computed), COUNT(NULLIF(meta_value LIKE '%"contributor"%', false) as Computed), COUNT(NULLIF(meta_value LIKE '%"subscriber"%', false) as Computed), COUNT(*) as Computed FROM wp_blogusermeta WHERE meta_key LIKE 'wp_blogcapabilities'

    http://wordpress.org/extend/plugins/wordpress-database-abstraction/

  2. Gideon7
    Member
    Posted 2 years ago #

    I get the same error on a fresh install of WordPress 3.4.1 on IIS 7.5 with SQL Server 2008 R2. Whenever I try to add a new user I get:

    WordPress database error: [[Microsoft][SQL Server Native Client 11.0][SQL Server]Incorrect syntax near the keyword 'LIKE'.]
    SELECT COUNT(NULLIF(meta_value LIKE '%"administrator"%', false) as Computed), COUNT(NULLIF(meta_value LIKE '%"editor"%', false) as Computed), COUNT(NULLIF(meta_value LIKE '%"author"%', false) as Computed), COUNT(NULLIF(meta_value LIKE '%"contributor"%', false) as Computed), COUNT(NULLIF(meta_value LIKE '%"subscriber"%', false) as Computed), COUNT(*) as Computed FROM wp_usermeta WHERE meta_key LIKE 'wp_capabilities'

    The problem is that naked boolean expressions are not allowed inside of a function. The above needs to be re-written to use a numerical expression:

    SELECT COUNT(CASE WHEN meta_value LIKE '%"administrator"%' THEN 1 ELSE 0 END) as Computed, COUNT(CASE WHEN meta_value LIKE '%"editor"%' THEN 1 ELSE 0) as Computed ...

  3. Gideon7
    Member
    Posted 2 years ago #

    To handle NULL cases use ISNULL(meta_value,''), like this:

    SELECT COUNT(CASE WHEN ISNULL(meta_value, '') LIKE '%"administrator"%' THEN 1 ELSE 0 END) as Computed, ...

  4. Andyt8
    Member
    Posted 2 years ago #

    Maybe I have some simular problem. I didn't created any user, but I get an simular error message.

    Was you able to solve that for yourself?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic