diff --git a/SQL Queries/OperationsManager/Quick Fixes/DropStats_Pre_and_Post.sql b/SQL Queries/OperationsManager/Quick Fixes/DropStats_Pre_and_Post.sql new file mode 100644 index 0000000..92d0cfd --- /dev/null +++ b/SQL Queries/OperationsManager/Quick Fixes/DropStats_Pre_and_Post.sql @@ -0,0 +1,7 @@ +DECLARE @sql NVARCHAR(MAX) = ''; + +SELECT @sql += 'DROP STATISTICS ' + QUOTENAME(OBJECT_SCHEMA_NAME(s.object_id)) + '.' + QUOTENAME(OBJECT_NAME(s.object_id)) + '.' + QUOTENAME(s.name) + ';' + CHAR(13) +FROM sys.stats s +WHERE s.name LIKE 'PRE\_%' ESCAPE '\' OR s.name LIKE 'POST\_%' ESCAPE '\'; + +EXEC sp_executesql @sql;