Dear Sujeet,
Can you please suggest how to find the fragmentation level by using command prompt? Thanksin advance for your help.
Regards,
Kolla Srikanth
Dear Sujeet,
Can you please suggest how to find the fragmentation level by using command prompt? Thanksin advance for your help.
Regards,
Kolla Srikanth
Hi Kolla,
Thanks for putting up your question here. Here is the SQL Script to know the fragmentation level of any table and its indexes. Also note that it gives the details about the fragmentation in percentage.
DECLARE @db_id INT;
DECLARE @object_id INT;
SET @db_id = db_id(N'Database Name');
SET @object_id = OBJECT_ID(N'Table Name');
BEGIN
SELECT *
FROM sys.dm_db_index_physical_stats(@db_Id, @object_ID, NULL, NULL , 'DETAILED') AS SKS;
END
GO
Hope this answers your query.
Regards,
Sujeet
Don't wait until you have got problems. Get the expert's advice, optimize your SQL Server and relax.
Contact for a SQL Sever Health Checkup Guidance today!
Always reachable through: