[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]
Leave a Reply