diff options
Diffstat (limited to 'system/database/drivers')
-rw-r--r-- | system/database/drivers/sqlsrv/sqlsrv_forge.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/system/database/drivers/sqlsrv/sqlsrv_forge.php b/system/database/drivers/sqlsrv/sqlsrv_forge.php index cc88ec5ca..d800c5074 100644 --- a/system/database/drivers/sqlsrv/sqlsrv_forge.php +++ b/system/database/drivers/sqlsrv/sqlsrv_forge.php @@ -60,7 +60,14 @@ class CI_DB_sqlsrv_forge extends CI_DB_forge { */ function _drop_table($table) { - return "DROP TABLE ".$this->db->_escape_identifiers($table); + $sql = ''; + $sql = "IF (EXISTS (SELECT * + FROM INFORMATION_SCHEMA.TABLES + WHERE TABLE_SCHEMA = 'dbo' + AND TABLE_NAME = '"; + $sql .= $this->db->_escape_identifiers($table)."')) DROP TABLE [dbo].["; + $sql .= $this->db->_escape_identifiers($table).']'; + return $sql; } // -------------------------------------------------------------------- |