Yii Framework Forum: Pagination In Mssql 2008 - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Pagination In Mssql 2008 Rate Topic: -----

#1 User is offline   yii_king 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 75
  • Joined: 05-August 12

Posted 24 February 2013 - 07:53 AM

I am able to do pagination with Yii and MySQL by doing something like this:

Quote

// Use this for pagination
$criteria=new CDbCriteria();
$count=carManager::model()->count($criteria);
$pages=new CPagination($count);

// Results per page in pagination
$pages->pageSize=10;
$pages->applyLimit($criteria);

// SQL
SELECT id FROM cars LIMIT $criteria->offset,$criteria->limit


However, this does not work in MSSQL 2008 as it does not have support for LIMIT. Can you please advise how to do pagination with MSSQL? Note that using TOP is not interesting as that will only return the N defined number of results. What I need is to retrieve results between 1-10, 11-20 etc.
0

#2 User is offline   le_top 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 188
  • Joined: 08-June 10
  • Location:France

Posted 24 February 2013 - 08:39 AM

Check out this forum entry :
http://www.yiiframew...post__p__193772
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users