Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 @@rowcount does'nt return the exact value the second time

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-04-25 : 19:04:18
Sher writes "Hi !

I am trying to count the number of records retrieved from a previously executed Select statement using the @@rowcount variable. i have noticed that the first time the ASP page is loaded the @@rowcount retrieves the number of records correctly. But for all the susequent select statements, the @rowcount is not changing according to the query. Only when i refresh the page again the first time works.

My select statement has lots of tables involved in it and based on the citeria the user selects in the form, the query is built and then I am trying to save the rowcount immediately after this query is executed. the results are displayed in a new window. After the first resultset is viewed, if i try to change the fields in my form and try to see the rowcount its still the first query's rowcount. I cannot use one particular field name to count the records.. i mean i am not able to use count( field_name) or count(*)due to the kind of query i have. So, i think that @@rowcount is the only option for me. Can u please help ?? I need to count the number of rows exactly for my business logic.

Thanks.
Sherp"
   

- Advertisement -