diff --git a/lib/PicoDb/Driver/Mssql.php b/lib/PicoDb/Driver/Mssql.php index 2598cf8..4b3e1b7 100644 --- a/lib/PicoDb/Driver/Mssql.php +++ b/lib/PicoDb/Driver/Mssql.php @@ -135,7 +135,7 @@ public function getLastId() */ public function getSchemaVersion() { - $this->pdo->exec("CREATE TABLE IF NOT EXISTS [".$this->schemaTable."] ([version] INT DEFAULT '0')"); + $this->pdo->exec("IF (OBJECT_ID('".$this->schemaTable."')) IS NULL CREATE TABLE [".$this->schemaTable."] ([version] INT DEFAULT '0')"); $rq = $this->pdo->prepare('SELECT [version] FROM ['.$this->schemaTable.']'); $rq->execute();