select * from sys.dm_db_index_physical_stats(DB_ID(), NULL, NULL, NULL, NULL)
where avg_fragmentation_in_percent > 30

