T-SQL Script to Check the ‘Auto Update Statistics’ Option for Each DB in an Instance

[sourcecode language=”sql”]
/*
Script to check if AutoUpdateStats option is turned on for all the DB’s in an instance.

Note: you have to take the output from the following script and run it again to get the final results.
*/

–SQL2000
select ‘select ”’ + name + ”’ as DB_Name, databasepropertyex(”’ + name + ”’, ”IsAutoUpdateStatistics”) as IsAutoUpdateStatisticsOn’
from master.dbo.sysdatabases

–SQL2005+
select ‘select ”’ + name + ”’ as DB_Name, databasepropertyex(”’ + name + ”’, ”IsAutoUpdateStatistics”) as IsAutoUpdateStatisticsOn’
from sys.databases

[/sourcecode]


Posted

in

by

Comments

Leave a Reply

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