freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
Re: [freetds] dbnextrow() vs dbskiprow() (skipping rows in FreeTDS)
- From: David Barnwell <david.barnwell AT well.ox.ac.uk>
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] dbnextrow() vs dbskiprow() (skipping rows in FreeTDS)
- Date: Mon, 28 Jul 2008 18:10:16 +0100
You can page through MSSQL tables 20 rows at a time using this SQL:
SELECT top 20 author, title, description FROM mytable
WHERE table_id NOT IN (
select top 12345 table_id from mytable
order by title
)
ORDER BY title
Here, table_id = primary key of the table
12345 = the next row to return (counting from 0)
I wrote a data browser that allows the user to page through any table and see the first/next/last 20 rows. It's surprisingly fast - on a table with 344000 rows it can select the last 20 rows in about a second.
-- David
Navdeep Shergill wrote:
I am trying to implement a mysql like paging; and this is one approach that
I am looking at. Mysql makes it realy easy with the LIMIT keyword; but I am
not having such luck with MSSQL. I am currently looking at the ROW_NUMBER
function ; but even that one requires me to do a order by on some column.
The problem is that the user may be trying to run some very generic queries;
and I need to be able to provide paging.. so I was looking at some way to
exec a query; and then go right to some arbitary row in the result set.
-
[freetds] dbnextrow() vs dbskiprow() (skipping rows in FreeTDS),
Navdeep Shergill, 07/27/2008
-
Re: [freetds] dbnextrow() vs dbskiprow() (skipping rows in FreeTDS),
Joel Fouse, 07/27/2008
-
Re: [freetds] dbnextrow() vs dbskiprow() (skipping rows in FreeTDS),
Navdeep Shergill, 07/27/2008
- Re: [freetds] dbnextrow() vs dbskiprow() (skipping rows in FreeTDS), David Chang, 07/27/2008
-
Re: [freetds] dbnextrow() vs dbskiprow() (skipping rows in FreeTDS),
David Barnwell, 07/28/2008
-
Re: [freetds] dbnextrow() vs dbskiprow() (skipping rows in FreeTDS),
Jason Young (Morgon), 07/28/2008
- Re: [freetds] dbnextrow() vs dbskiprow() (skipping rows in FreeTDS), Navdeep Shergill, 07/29/2008
-
Re: [freetds] dbnextrow() vs dbskiprow() (skipping rows in FreeTDS),
Jason Young (Morgon), 07/28/2008
-
Re: [freetds] dbnextrow() vs dbskiprow() (skipping rows in FreeTDS),
Navdeep Shergill, 07/27/2008
- Re: [freetds] dbnextrow() vs dbskiprow() (skipping rows in FreeTDS), James K. Lowden, 07/28/2008
-
Re: [freetds] dbnextrow() vs dbskiprow() (skipping rows in FreeTDS),
Joel Fouse, 07/27/2008
Archive powered by MHonArc 2.6.24.