Meaning of 'show variables LIKE '%_database' Despite being a newbie in db administration, I have been assigned to move our crm from mysql to mssql. I have reached a point where I have met a query I dont understand and it cannot execute in sql server.
show variables LIKE '%_database'

The following is the code it:

public static function checkDbUTF8Support($conn) {
    global $db_type;
    if($db_type == 'pgsql')
        return true;
    $dbvarRS = $conn-&gt;Execute("show variables like '%_database' ");
    $db_character_set = null;
    $db_collation_type = null;
    while(!$dbvarRS-&gt;EOF) {
        $arr = $dbvarRS-&gt;FetchRow();
        $arr = array_change_key_case($arr);
        switch($arr['variable_name']) {
            case 'character_set_database' : $db_character_set = $arr['value']; break;
            case 'collation_database'     : $db_collation_type = $arr['value']; break;
        }
        // If we have all the required information break the loop. 
        if($db_character_set != null &amp;&amp; $db_collation_type != null) break;
    }
    return (stristr($db_character_set, 'utf8') &amp;&amp; stristr($db_collation_type, 'utf8'));
}
}


Can someone assist me with an explanation and a possible solution
Show Variables is not ANSI SQL, it's MySQL specific, so it won't run across database providers.

Reading through that code it looks like it's trying to determine if the database provider will support UTF8.

If you Google it, the Show Variables is a MySQL command which returns information about the current database.

I think you will have to replace this whole section with different code to determine if the database in use will support UTF8, which I suspect is dependent on the collation.

You can find this information in the sys. tables.

Googling MSSQL Server and UTF8 seems to indicate that MS don't explicitly support UTF8, however.

This is an answer to your question "what is show variables", not a solution to your problem "how can my application run a query to determine UTF8 support in the database?"

HTH