[geeklog-devel] MS SQL question

Michael Jervis mjervis at gmail.com
Wed Jun 25 14:48:45 EDT 2008


SELECT 1 FROM sysobjects WHERE name= '{$_TABLES[$table]}'

Probably want to check XTYPE as well, but I can't recall right now the
correct value for table.

On Wed, Jun 25, 2008 at 19:44, Dirk Haun <dirk at haun-online.de> wrote:
> 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/
>
> _______________________________________________
> geeklog-devel mailing list
> geeklog-devel at lists.geeklog.net
> http://eight.pairlist.net/mailman/listinfo/geeklog-devel
>



-- 
Michael Jervis
mjervis at gmail.com
504B03041400000008008F846431E3543A820800000006000000060000007765
62676F642B4F4D4ACF4F0100504B010214001400000008008F846431E3543A82
0800000006000000060000000000000000002000000000000000776562676F64
504B05060000000001000100340000002C0000000000



More information about the geeklog-devel mailing list