dcsimg
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Tip: Using sys.dm_db_index_physical_stats

Learn how to return size and fragmentation information for the data and indexes of the specified table or view in SQL Server.


advertisement

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


Using dm_db_index_physical_stats returns size and fragmentation information for the data and indexes of the specified table or view in SQL Server.

USE master;  
GO  
-- If Student.Name does not exist in the database, the function returns NULL.  
-- If NULL is specified as an OBJECT_ID, all objects in the database are returned.  
SELECT * FROM sys.dm_db_index_physical_stats  
    (DB_ID(N'AdventureWorks'), OBJECT_ID(N'Student.Name'), NULL, NULL , 'DETAILED');

 

Visit the DevX Tip Bank

 





   
Thanks for your registration, follow us on our social networks to keep up-to-date