@@ -1210,15 +1210,15 @@ BEGIN TRY
12101210 ELSE N'' ''
12111211 END AS filter_definition' ELSE N ' '' '' AS filter_definition' END + N'
12121212 , ISNULL(us.user_seeks, 0),
1213- ISNULL(us.user_scans, 0),
1213+ ISNULL(us.user_scans, 0),
12141214 ISNULL(us.user_lookups, 0),
1215- ISNULL(us.user_updates, 0),
1216- us.last_user_seek,
1217- us.last_user_scan,
1215+ ISNULL(us.user_updates, 0),
1216+ us.last_user_seek,
1217+ us.last_user_scan,
12181218 us.last_user_lookup,
1219- us.last_user_update,
1219+ us.last_user_update,
12201220 so.create_date,
1221- so.modify_date
1221+ so.modify_date
12221222 FROM ' + QUOTENAME (@DatabaseName) + N' .sys.indexes AS si WITH (NOLOCK)
12231223 JOIN ' + QUOTENAME (@DatabaseName) + N' .sys.objects AS so WITH (NOLOCK) ON si.object_id = so.object_id
12241224 AND so.is_ms_shipped = 0 /*Exclude objects shipped by Microsoft*/
@@ -1230,12 +1230,12 @@ BEGIN TRY
12301230 WHERE si.[type] IN ( 0, 1, 2, 3, 4, 5, 6 )
12311231 /* Heaps, clustered, nonclustered, XML, spatial, Cluster Columnstore, NC Columnstore */ ' +
12321232 CASE WHEN @TableName IS NOT NULL THEN N ' and so.name=' + QUOTENAME (@TableName,N ' '' ' ) + N ' ' ELSE N ' ' END +
1233- CASE WHEN ( @IncludeInactiveIndexes = 0
1234- OR @Mode NOT IN (0 , 4 )
1235- OR @TableName IS NOT NULL )
1236- THEN N ' AND ( us.user_seeks + us.user_scans + us.user_lookups + us.user_updates ) > 0'
1237- ELSE N ' '
1238- END
1233+ CASE WHEN ( @IncludeInactiveIndexes = 0
1234+ OR @Mode NOT IN (0 , 4 )
1235+ OR @TableName IS NOT NULL )
1236+ THEN N ' AND ( us.user_seeks + us.user_scans + us.user_lookups + us.user_updates ) > 0'
1237+ ELSE N ' '
1238+ END
12391239 + N' OPTION ( RECOMPILE );
12401240 ' ;
12411241 IF @dsql IS NULL
0 commit comments