diff options
author | tino <tino@quadforce> | 2013-10-18 11:21:47 +0200 |
---|---|---|
committer | blowdoof <blowdoof@gmail.com> | 2013-10-18 15:50:17 +0200 |
commit | 6f52325abecad238b4c0a3097b0d849bf685adce (patch) | |
tree | ea13730ebb3112bef96c9e24534a79cc110f44c9 /system | |
parent | 508aa787c1203a42d1103617bba122e312bd5088 (diff) |
Fix on sqlsrv_forge drop_table
Diffstat (limited to 'system')
-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; } // -------------------------------------------------------------------- |