Groups | Blog | Home
all groups > sql server (microsoft) > april 2007 >

sql server (microsoft) : SQL 2000 version of sys.dm_db_index_physical_stats?


billnoble204 NO[at]SPAM hotmail.com
4/10/2007 4:05:35 AM
Hello,

I have the following SQL script:

INSERT @work_to_do
SELECT
f.object_id
, index_id
, avg_page_space_used_in_percent
, avg_fragmentation_in_percent
, record_count
FROM
sys.dm_db_index_physical_stats (DB_ID(), NULL, NULL , NULL, NULL,
'SAMPLED') AS f;
WHERE
(f.avg_page_space_used_in_percent < 85.0 and
f.avg_page_space_used_in_percent/100.0 * page_count < page_count - 1)
or (f.page_count > 50 and f.avg_fragmentation_in_percent > 15.0)
or (f.page_count > 10 and f.avg_fragmentation_in_percent > 80.0)

This is supposed to work on SQL 2005. But I have SQL 2000. I guess
sys.dm_db_index_physical_stats is not supported in 2000.

Could someone give me a hand converting this script for SQL 2000?

BillN
amish
4/10/2007 6:52:53 AM
[quoted text, click to view]

Look at dbcc showcontig in BOL .

Regards
Amish shah
http://shahamishm.tripod.com

AddThis Social Bookmark Button