summaryrefslogtreecommitdiffstats
path: root/system/database/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'system/database/drivers')
-rw-r--r--system/database/drivers/sqlsrv/sqlsrv_driver.php4
1 files changed, 1 insertions, 3 deletions
diff --git a/system/database/drivers/sqlsrv/sqlsrv_driver.php b/system/database/drivers/sqlsrv/sqlsrv_driver.php
index 8d383b274..1df3a4258 100644
--- a/system/database/drivers/sqlsrv/sqlsrv_driver.php
+++ b/system/database/drivers/sqlsrv/sqlsrv_driver.php
@@ -275,9 +275,7 @@ class CI_DB_sqlsrv_driver extends CI_DB {
*/
public function insert_id()
{
- $query = $this->query('SELECT @@IDENTITY AS insert_id');
- $query = $query->row();
- return $query->insert_id;
+ return $this->query('SELECT SCOPE_IDENTITY() AS insert_id')->row()->insert_id;
}
// --------------------------------------------------------------------