How to disable Auto Shrink all SQL databases

You can use the following code in query generated to disable auto shrink on all SQL databases.  This code will generate the actual scripts needed, which you then execute.  See the comment section above the code snipped for instructions.

/* This will script output the needed commands for you */
/* Execute it in query analyzer, which will generates all the commands */
/* do a Select All, Copy, then Paste into query analyzer and execute */
SELECT ‘ALTER DATABASE ‘ + QUOTENAME(name) + ‘ SET AUTO_SHRINK OFF WITH NO_WAIT;’ AS [To Execute]
FROM sys.databases
WHERE is_auto_shrink_on = 1;
GO

Related

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.