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.
| Author |
Topic |
|
m_simpson11
Starting Member
2 Posts |
Posted - 2007-02-05 : 19:16:18
|
| If I right click and browse the properties for the table I can get the value of rows. But for the same table if I do select count(*) from table the value does not match the table properties rows. Please can some one tell me why this is so?SQL Newbie |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-02-05 : 19:21:14
|
| It is due to inaccuracies in sysindexes. You can correct the inaccuracies via DBCC UPDATEUSAGE. Be warned though not to rely on the value as it's only accurate if you've just run DBCC UPDATEUSAGE (or UPDATE STATISTICS with @updateusage = TRUE) and no new rows have been updated and no rows have been deleted.The only way to guarantee the correct count is to use COUNT(*) with no WHERE clause.Tara Kizer |
 |
|
|
m_simpson11
Starting Member
2 Posts |
Posted - 2007-02-05 : 19:45:31
|
quote: Originally posted by tkizer It is due to inaccuracies in sysindexes. You can correct the inaccuracies via DBCC UPDATEUSAGE. Be warned though not to rely on the value as it's only accurate if you've just run DBCC UPDATEUSAGE (or UPDATE STATISTICS with @updateusage = TRUE) and no new rows have been updated and no rows have been deleted.The only way to guarantee the correct count is to use COUNT(*) with no WHERE clause.Tara Kizer
Thank you so much. I thought that any reply will take some time. Thanks again SQL Newbie |
 |
|
|
|
|
|