« Sql » : différence entre les versions

De bricosoft
Aucun résumé des modifications
Aucun résumé des modifications
Ligne 19 : Ligne 19 :
ORDER BY phystat.avg_fragmentation_in_percent DESC
ORDER BY phystat.avg_fragmentation_in_percent DESC
</pre>
</pre>
https://ola.hallengren.com/

Version du 7 décembre 2016 à 10:14

jointures

http://blog.codinghorror.com/a-visual-explanation-of-sql-joins/


sql server

index

SELECT
    OBJECT_NAME(i.OBJECT_ID) AS TableName,
    i.name AS TableIndexName
FROM
    sys.dm_db_index_physical_stats(DB_ID(), NULL, NULL, NULL, 'DETAILED') phystat 
    INNER JOIN sys.indexes i 
        ON i.OBJECT_ID = phystat.OBJECT_ID AND i.index_id = phystat.index_id 
WHERE 
    phystat.avg_fragmentation_in_percent > 20 
    AND OBJECT_NAME(i.OBJECT_ID) IS NOT NULL
ORDER BY phystat.avg_fragmentation_in_percent DESC

https://ola.hallengren.com/