Re: equivalent to LIMIT?
Posted in 2003
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL, Migration, Import/Export & Data Conversion, Versions, Editions & End-of-Life
In an UNLOAD statement you can use STARTROW and ENDROW like this:
UNLOAD {+STARTROW=400 ENDROW=449}
TO "/tmp/mytable.unl"
SELECT * FROM mytable
WHERE <condition>;
This works on IDS 7.31 and above. I'm not sure for other versions. I learned
that from Informix Server Studio (http://www.serverstudio.com), where you
can get free 15-day trial copy.
I hope this helps.
Gorazd
"Brian" <brian@comdotorg.com> wrote in message
news:bkqllg$9b4$1@ftupet.com...
> Was wondering if there's an Informix equivalent to the LIMIT clause seen
> in MySQL and PostgreSQL (and possibly others)?
> Right now, if our devs need rows 400-450 in a 10,000 row table, they
> SELECT TOP 450, but that just seems inefficient especially when you get
> to returning 10k rows when you only need the last 50.
Gorazd Hribar Rajteriďż˝ wrote:
> In an UNLOAD statement you can use STARTROW and ENDROW like this:
>
> UNLOAD {+STARTROW=400 ENDROW=449}
> TO "/tmp/mytable.unl"
> SELECT * FROM mytable
> WHERE <condition>;>
> This works on IDS 7.31 and above. I'm not sure for other versions. I learned
> that from Informix Server Studio (http://www.serverstudio.com), where you
> can get free 15-day trial copy.
>
> I hope this helps.
>
"UNLOAD" is not an SQL statement. It's a commodity implemented by some tools (SQL Editor, DBaccess, ISQL...)
The above HINTS aren't documented in any manual I've seen and I can't grep it from oninit.
As such I suppose it's a feature only used in ServerStudio (a fantastic tool wich would be nicer if sold by IBM).
And I suppose you forgot the load from mytable.unl...?
Regards.
> "UNLOAD" is not an SQL statement. It's a commodity implemented by some
tools (SQL Editor, DBaccess, ISQL...)
> The above HINTS aren't documented in any manual I've seen and I can't grep
it from oninit.
> As such I suppose it's a feature only used in ServerStudio (a fantastic
tool wich would be nicer if sold by IBM).
Yes, of course you're right on both matters! I apologize for my missguided
post.
> And I suppose you forgot the load from mytable.unl...?
Sorry, I don't get it...
Gorazd