Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Ultimate Question: Oracle, MSSQL, Others vs MYSQL LIMIT Statement

Re: Ultimate Question: Oracle, MSSQL, Others vs MYSQL LIMIT Statement

From: Jesus Christ's Evil Twin <radpin_at_hotmail.com>
Date: 18 Sep 2002 12:44:44 -0700
Message-ID: <2a0f8137.0209181144.480aa14b@posting.google.com>


In regards to SQL Server's ability to do this (ver 2000), there seems to be two major hurdles.

This statement works just ducky:

SELECT * FROM
(SELECT TOP 10 * FROM
(SELECT TOP 150 * FROM TEMP_ERIC ORDER BY COL1 ASC)

	 AS T1 ORDER BY COL1 DESC)
	 AS T2 ORDER BY COL1 ASC


But the problem is fairly obvious. You cannot use input paramaters for top values, and as such either have to:

  1. hardwire in the top value in a procedure, which is absurd
  2. write an if statement allowing for every possible combination possible, the ability to do so being equiv to item (a)

or

c) pass dynamic sql after a string function tweaks things the way you need them.

All three are poor, with c being the only way I can imagine things to work, and that is a horrible alternative.

Anyone have any ideas for item (d)?

And please refrain from making item (d) get mysql! or anything of the sort.

:-) Received on Wed Sep 18 2002 - 14:44:44 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US