Sunday, 4 February 2018

How to get a single table Fragmentaion

How To Find a single table Fragmentation in respective database on sql server 2005\8\8R2\12\14\16, use below query to get the fragmentation information

Use Your_DB_Name
go
SELECT
                     DB_NAME([ddips].[database_id]) AS [DatabaseName]
                     , OBJECT_NAME([ddips].[object_id]) AS [TableName]
                     , [i].[name] AS [IndexName] , [ddips].[avg_fragmentation_in_percent] as [Fragmentation]
FROM          [sys].[dm_db_index_physical_stats](DB_ID('Your_DB'),OBJECT_ID('Your_DB_Table_Name'), NULL, NULL, NULL) AS ddips --Please change database name and table name
INNER JOIN    [sys].[indexes] AS i ON [ddips].[index_id] = [i].[index_id]
AND                  [ddips].[object_id] = [i].[object_id]

go

Disable CDC at table level

 How to Disable CDC( Change Data Capture) for tables Change Data Capture (cdc) property is disabled as default.  here I will Query you how t...