[Pugged] There is no LIMIT to MS-SQL
Steve Langasek
ciapug@ciapug.org
Thu, 10 Oct 2002 19:23:42 -0500
--3V7upXqbjpZ4EhLz
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Thu, Oct 10, 2002 at 10:54:19PM -0000, dave@visionary.com wrote:
> A while back we had a discussion about paginating results. Tim pointed=20
> out that you can use the LIMIT clause like so:
> "SELECT * FROM mytable WHERE column_x =3D $y LIMIT $nStart, $nEnd"
> This is really handy, except... it's not supported in all SQL servers,=20
> only mySQL (and maybe PostgreSQL? Others?). Neither Oracle or MS-SQL=20
> support it. :(
PostgreSQL supports LIMIT and OFFSET. AIUI, with MS-SQL the recommended=20
way to do this is by creating a temporary table to store the results of=20
your query, and querying sets of records out of that temporary table.
Steve Langasek
postmodern programmer
--3V7upXqbjpZ4EhLz
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.0 (GNU/Linux)
iD8DBQE9phoOKN6ufymYLloRAstiAJ9YlZMBvIV7MLTyEN2oUXpMyHFMvACcC4kI
P2zFWlRnMyoNfDYdAQFK+M8=
=o/ll
-----END PGP SIGNATURE-----
--3V7upXqbjpZ4EhLz--