Tuesday, March 20, 2012

Problem on "Select count(*)"

HI,

We have one table have problem when run "select count(*) from table". This is a sql 2000 server. it returned different count everytime when I ran the "select count(*) from table". I used DBCC to check the table and did not find any problems. I can fix it by recreate the table and reimport the data, but the problem come back after we update some data in the table monthly with a stored procedure. Any suggestion?

Thanks

Sand

Try fully qualifying the table name (database.schema.table) and using a new connection from the same PC each time you exeucte the select count(*)

You want to make sure you are selecting from the same database on the same server from the same table everytime. And a new connection to make sure you don't have rowcount or some other option interfering.

-Sue

No comments:

Post a Comment