|
2 | 2 | /* This script provided AS IS, Please review the code before executing this on production environment */
|
3 | 3 | /* For any issue or suggestion please email to: [email protected] */
|
4 | 4 |
|
| 5 | + |
| 6 | +/* |
| 7 | +*********************************************** |
| 8 | + Current Version Date: 2017-12-12 |
| 9 | +*********************************************** |
| 10 | + |
| 11 | +Change Log: |
| 12 | + 2017-12-12: fix total indexes reported to the output window. functionality was not impacted by this issue. |
| 13 | + |
| 14 | +*/ |
| 15 | + |
5 | 16 | if object_id('AzureSQLMaintenance') is null
|
6 | 17 | exec('create procedure AzureSQLMaintenance as /*dummy procedure body*/ select 1;')
|
7 | 18 | GO
|
@@ -104,15 +115,15 @@ begin
|
104 | 115 | raiserror('Index Information:',0,0) with nowait
|
105 | 116 | raiserror('---------------------------------------',0,0) with nowait
|
106 | 117 |
|
107 |
| - select @msg = count(*) from #idxBefore where index_id in (1,2) |
| 118 | + select @msg = count(*) from #idxBefore |
108 | 119 | set @msg = 'Total Indexes: ' + @msg
|
109 | 120 | raiserror(@msg,0,0) with nowait
|
110 | 121 |
|
111 |
| - select @msg = avg(avg_fragmentation_in_percent) from #idxBefore where index_id in (1,2) and page_count>@minPageCountForIndex |
| 122 | + select @msg = avg(avg_fragmentation_in_percent) from #idxBefore where page_count>@minPageCountForIndex |
112 | 123 | set @msg = 'Average Fragmentation: ' + @msg
|
113 | 124 | raiserror(@msg,0,0) with nowait
|
114 | 125 |
|
115 |
| - select @msg = sum(iif(avg_fragmentation_in_percent>=5 and page_count>@minPageCountForIndex,1,0)) from #idxBefore where index_id in (1,2) |
| 126 | + select @msg = sum(iif(avg_fragmentation_in_percent>=5 and page_count>@minPageCountForIndex,1,0)) from #idxBefore |
116 | 127 | set @msg = 'Fragmented Indexes: ' + @msg
|
117 | 128 | raiserror(@msg,0,0) with nowait
|
118 | 129 |
|
|
0 commit comments