[geeklog-devel] MS SQL question

Dirk Haun dirk at haun-online.de
Wed Jun 25 14:44:50 EDT 2008


In the install script, we have this function:

/**
 * Check if a table exists
 *
 * @param   string $table   Table name
 * @return  boolean         True if table exists, false if it does not
 *
 */
function INST_checkTableExists ($table)
{
    global $_TABLES, $_DB_dbms;

    $exists = false;

    if ($_DB_dbms == 'mysql') {
        $result = DB_query ("SHOW TABLES LIKE '{$_TABLES[$table]}'");
        if (DB_numRows ($result) > 0) {
            $exists = true;
        }
    }

    return $exists;
}

As can be seen, it's only covering MySQL. How would you check for the
existance of a table in MS SQL?

bye, Dirk


-- 
http://www.geeklog.net/
http://geeklog.info/




More information about the geeklog-devel mailing list