November 8, 2011 at 9:06 pm
SELECT o.name,
ips.partition_number,
ips.index_type_desc,
ips.record_count, ips.avg_record_size_in_bytes,
ips.min_record_size_in_bytes,
ips.max_record_size_in_bytes,
ips.page_count, ips.compressed_page_count
FROM sys.dm_db_index_physical_stats ( DB_ID(), NULL, NULL, NULL, 'DETAILED') ips
JOIN sys.objects o on o.object_id = ips.object_id
ORDER BY record_count DESC;
Hi All,
I need a help, I am unable to find the error in the script.
Msg 102, Level 15, State 1, Line 8
Incorrect syntax near '('.
November 8, 2011 at 9:47 pm
Which version of SQL are you running this on? I ran it without error against 2008 EE...did you parse the query? Are you certain you selected all of it?
______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience
November 8, 2011 at 10:59 pm
this script will give u fragmentation of particular database
SELECT ps.database_id, ps.OBJECT_ID, ps.index_id, si.name, ps.avg_fragmentation_in_percent,
(SELECT distinct so.name FROM sys.objects so INNER JOIN sys.indexes ON so.object_id = si.object_id) ParentTable
FROM sys.dm_db_index_physical_stats (DB_ID(13), NULL, NULL, NULL, NULL) AS ps
INNER JOIN sys.indexes si ON ps.OBJECT_ID = si.OBJECT_ID
AND ps.index_id = si.index_id
WHERE si.name is not null AND
ps.avg_fragmentation_in_percent > 10 -- min % to return
ORDER BY ps.avg_fragmentation_in_percent desc
GO
November 8, 2011 at 11:18 pm
nlakka (11/8/2011)
SELECT o.name,ips.partition_number,
ips.index_type_desc,
ips.record_count, ips.avg_record_size_in_bytes,
ips.min_record_size_in_bytes,
ips.max_record_size_in_bytes,
ips.page_count, ips.compressed_page_count
FROM sys.dm_db_index_physical_stats ( DB_ID(), NULL, NULL, NULL, 'DETAILED') ips
JOIN sys.objects o on o.object_id = ips.object_id
ORDER BY record_count DESC;
Hi All,
I need a help, I am unable to find the error in the script.
Msg 102, Level 15, State 1, Line 8
Incorrect syntax near '('.
This script as provided works fine in SQL 2008 R2.
Did you by chance have only part of the script highlighted when trying to run it?
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply