Holy Grail: Accurate Record Count w/Forward Only C

Results 1 to 3 of 3

Thread: Holy Grail: Accurate Record Count w/Forward Only C

  1. #1
    wken Guest

    Default Holy Grail: Accurate Record Count w/Forward Only C

    I&#039m trying to obtain both the speed of caching my dynamic queries and obtain an accurate record count.<BR>The @@ROWCOUNT is accurate after performing a select, even when using sp_executeSQL. I tried it in Query Analyzer.<BR><BR>My Stored Procedure&#039s main two commands are<BR> EXECUTE sp_executeSQL @SQLString <BR> SELECT @RecCount = @@ROWCOUNT <BR><BR>But how do I get that number out of SQL into ASP?<BR>If I do this in ASP:<BR> objCommand.Execute<BR>My output parameter is set to the correct record count.<BR>If I do this is ASP:<BR> Set resultRecordSet = objCommand.Execute<BR>My output parameter is not set at all.<BR><BR>Is what I am seeking like the Uncertainty Principle: by knowing one, I cannot know the other without performing the query twice?<BR>Please Help me in my quest,<BR>Sincerely,<BR>wken

  2. #2
    Jason Miller Guest

    Default SQL Count feature

    I&#039ve used this once and not found supporting docs for it, so I don&#039t know how well it will work... But...<BR><BR>You can get an accurate count by saying "select count(field) from db blah blah blah" -- and you should be able to get your other fields as well, but as I said, I&#039ve not used it much. I just know that for that limited use, it works fine.<BR><BR>Think I heard it from the SQL Guru, but my memory gets fuzzy that far back.

  3. #3
    Michael Swanson Guest

    Default RE: Holy Grail: Accurate Record Count w/Forward On

    I&#039m not sure if the driver supports it or not, but ADO will return a "records affected" number with your execute method, as in:<BR><BR>command.Execute RecordsAffected, Parameters, Options<BR><BR>Hope this helps...<BR><BR>Michael Swanson, MCSE, MCP+Internet<BR>Webmaster<BR>Donnelly Corporation<BR>mike.swanson@donnelly.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts