Browse Source

Addresses #75

This fix should address https://github.com/Microsoft/tigertoolbox/issues/75 where `[compression_type]` is returned empty if running SQL Server 2005 (all builds).
Randolph West 7 years ago
parent
commit
9e058452f2
1 changed files with 1 additions and 1 deletions
  1. 1 1
      AdaptiveIndexDefrag/usp_AdaptiveIndexDefrag.sql

+ 1 - 1
AdaptiveIndexDefrag/usp_AdaptiveIndexDefrag.sql

@@ -1719,7 +1719,7 @@ AND ids.[dbID] = ' + CAST(@dbID AS NVARCHAR(10));
 				IF @scanMode = 'LIMITED'
 				BEGIN
 					SELECT @updateSQL = N'UPDATE ids		
-SET [record_count] = [rows], [compression_type] = [data_compression_desc] 
+SET [record_count] = [rows], [compression_type] = CASE WHEN @sqlmajorver = 9 THEN N'' ELSE [data_compression_desc] END
 FROM [' + DB_NAME(@AID_dbID) + '].dbo.tbl_AdaptiveIndexDefrag_Working ids WITH (NOLOCK)
 INNER JOIN [' + DB_NAME(@dbID) + '].sys.partitions AS p WITH (NOLOCK) ON ids.objectID = p.[object_id] AND ids.indexID = p.index_id AND ids.partitionNumber = p.partition_number
 WHERE ids.[dbID] = ' + CAST(@dbID AS NVARCHAR(10));