Skip to content

Commit

Permalink
Add query to drop stats for Pre_ and Post_ 🦑
Browse files Browse the repository at this point in the history
  • Loading branch information
blakedrumm authored Sep 8, 2023
1 parent 6bd2fe5 commit 12ca22c
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit 12ca22c

Please sign in to comment.