Skip to Content.
Sympa Menu

freetds - Re: [freetds] Num of rows ruturned by a query

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Brian Bruns <brian.bruns AT gmail.com>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] Num of rows ruturned by a query
  • Date: Thu, 28 Apr 2005 20:14:24 -0400

This is a protocol limitation. The advantage of sql server doing it
this way is that it can begin returning rows before knowing how many
there will be. That is, if you "order by" an indexed column the
server begins sending rows immediately without building a work table
and therefore the total number is unknown.

Work arounds are to do a count(*) first or to row buffer the results
(if you know the number of rows is relatively small).

Brian

On 4/28/05, martin martin <acevedoma AT hotmail.com> wrote:
> Is it possible to know how many rows are returned by a "select" query before
> iterating the rows.
> I use a -db-lib- function's "dbcount ()" but it always returns -1 before
> fetching the rows.
> Thanks
>
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds
>




Archive powered by MHonArc 2.6.24.

Top of Page