return number of rows from a query

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf return number of rows from a query

  • Creator
    Topic
  • #51086
    Rick Pritchett
    Participant

      Need to know how to get the number of rows returned by a query using the odbc drivers.

    Viewing 1 reply thread
    • Author
      Replies
      • #68737
        Charlie Bursell
        Participant

          SELECT COUNT(*) FROM MYTABLE WHERE X = ‘Y’

        • #68738
          David Barr
          Participant

            I think that depends on the type of query that you are doing.

            Looking at one of our queries, we use SQLExecDirect to execute the query, then we repeatedly call SQLFetch to fetch each row until SQLFetch returns SQL_NO_DATA_FOUND.  If I wanted to count the rows returned, I’d probably just keep a counter that I incremented each time we successfully called SQLFetch.

        Viewing 1 reply thread
        • The forum ‘Cloverleaf’ is closed to new topics and replies.