• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SQL Server 2012 (11.0.*) OFFSET NOT supported on mssql_driver LIMIT


My first post on this forum!
I'm using CI + FlexiGrid + MySQL for a web app. This works very well.
Now I'm converting it to use MS SQL Server 2012 and the pagination don't works anymore...
After several tests I found the problem:

On the sqlsrv_driver.php file, on the _limit() method, the code starts this way:
PHP Code:
    protected function _limit($sql)


// As of SQL Server 2012 (11.0.*) OFFSET is supported
if (version_compare($this->version(), '11''>='))
// SQL Server OFFSET-FETCH can be used only with the ORDER BY clause
empty($this->qb_orderby) && $sql .= ' ORDER BY 1';

$sql.' OFFSET '.(int) $this->qb_offset.' ROWS FETCH NEXT '.$this->qb_limit.' ROWS ONLY';

But on the mssql_driver.php file this piece of code don't exists.
After I copyed the piece of code to this file, my web app worked again!

This is a bug or a feature?
I'm on CI 3.1.4, but the files are the same on CI 3.1.7...

Just my 0.02...
Thank you for any advice!

The mssql driver is deprecated; use sqlsrv.

Thx for reply!
I'm trying to access MS SQL from Linux, using PHP 5.6. But I didn't find the sqlsrv driver for PHP 5.6
Any advice?


My advice is to upgrade PHP ... Even 7.0 is already in security maintenance mode.

OK, thx!!

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.