You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
--Below block only works in SQL 2014+, comment out this line in prior versions.
31
+
/*
27
32
+ CASE WHEN
28
33
STA.Is_Incremental = 1 and --Only works in SQL 2014+, comment out this line in prior versions.
29
34
MAX(p.partition_number) OVER (PARTITION by STA.name, i.name) > 1 THEN '' ON PARTITIONS ('' + cast(p.partition_number as varchar(5)) + '') '' ELSE '''' END
30
-
35
+
*/
31
36
END
32
37
FROM sys.objects o
33
38
INNER JOIN sys.stats STA ON STA.object_id = o.object_id
@@ -37,12 +42,15 @@ declare @tsql nvarchar(max) =
37
42
LEFT OUTER JOIN sys.indexes as i
38
43
on i.index_id = STA.stats_id
39
44
and (i.type_desc not like ''%columnstore%'')
45
+
--Below block only works in SQL 2014+, comment out this line in prior versions.
46
+
/*
40
47
LEFT OUTER join sys.dm_db_partition_stats p
41
48
on (
42
49
STA.Is_Incremental = 1 and --Only works in SQL 2014+, comment out this line in prior versions.
43
50
p.object_id = o.object_id and
44
51
i.index_id = p.index_id
45
52
)
53
+
*/
46
54
LEFT JOIN
47
55
(SELECT IUS.object_id
48
56
,MIN(ISNULL(IUS.last_user_update, IUS.last_system_update)) AS LastUpdate
0 commit comments