Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagesql
titleSQL - index fragmentation script - 30 dan yüksek parçalanmaya sahip indexleri listeler, bu indexlerin yeniden rebuild edilmesi gerekir. Tablodan tekrar eden kayıtların temizlenmesi için kullanılabilecek sorgu
linenumberstrue
WITH cte AS (
    SELECT 
        Id, 
        Field1,
        Field2, 
        ROW_NUMBER() OVER (
            PARTITION BY 
                Field1, 
                Field2
			ORDER BY
				Field1,
				Field2
        ) row_num
     FROM 
        Table_Name
)
DELETE FROM cte
WHERE row_num > 1;	

...