June 21, 2011 at 7:19 am
Hi
For me count 207 rows when i use
SELECT
sysobjects.Name
, sysindexes.Rows
FROM
sysobjects
INNER JOIN sysindexes
ON sysobjects.id = sysindexes.id
WHERE
type = 'U'
AND sysindexes.IndId < 2
ORDER BY
sysobjects.Namecode
to get count of rows
and when i make "select count(*) from tableName" show me 209 rows why (This happen only in case of 3 tables) Why?
Can some one help me out with this please
June 21, 2011 at 7:43 am
the counts are probably out of date, try running ;
DBCC UPDATEUSAGE
June 21, 2011 at 3:05 pm
Sorry. Missed the second column in the first query.
June 22, 2011 at 1:02 am
June 22, 2011 at 1:37 am
Jayanth_Kurup (6/22/2011)
select row_count from sys.dm_db_partition_statswhere object_id = (object_id('abcd'))
try this , it was asked a q Qotd and works faster
its worth noting that this method can still be inaccurate, as the only fully accurate way is count(*)
June 22, 2011 at 2:39 am
I was under the assumption that dm_db_partition_stats was accurate , i tried to create a few scenarios where is tot it would be inaccurate but didn't face any problems.
Here's an article I found on the topic.
June 22, 2011 at 2:49 am
Jayanth_Kurup (6/22/2011)
Here's an article I found on the topic.
http://www.sqlservercentral.com/articles/T-SQL/67624/%5B/quote%5D
thanks for the link , I was under the assumption that it could be inaccurate but it appears not..
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply