Last active
March 6, 2026 10:14
-
-
Save ghotz/783ed7c20104ccc22158fc670d3244dd to your computer and use it in GitHub Desktop.
Evaluate Auto Shrink database option
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT | |
| [name] AS database_name, is_auto_shrink_on | |
| , 'ALTER DATABASE [' + [name] + ']' + ' SET AUTO_SHRINK OFF;' AS alter_command | |
| FROM sys.databases | |
| WHERE [name] NOT IN ('master','model','msdb','tempdb') | |
| AND state_desc = 'ONLINE' | |
| AND is_auto_shrink_on = 1 | |
| ORDER BY [name] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment