Commit 991a8945 by Qiang Xue

Added missing `ROWS` token when building limit/offset for MSSQL.

parent 1fd00683
...@@ -60,7 +60,7 @@ class QueryBuilder extends \yii\db\QueryBuilder ...@@ -60,7 +60,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
$hasLimit = $this->hasLimit($limit); $hasLimit = $this->hasLimit($limit);
if ($hasOffset || $hasLimit) { if ($hasOffset || $hasLimit) {
// http://technet.microsoft.com/en-us/library/gg699618.aspx // http://technet.microsoft.com/en-us/library/gg699618.aspx
$sql = 'OFFSET ' . ($hasOffset ? $offset : '0'); $sql = 'OFFSET ' . ($hasOffset ? $offset : '0') . ' ROWS';
if ($hasLimit) { if ($hasLimit) {
$sql .= " FETCH NEXT $limit ROWS ONLY"; $sql .= " FETCH NEXT $limit ROWS ONLY";
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment