Labels

Tuesday, 1 November 2016

How to change all database comparability level from 90 to 100

During database migration ,I got the requirement to change the database recovery model from 90 to 100 i.e from SQL Server 2005 to SQL Server 2008.

You can also use the below script if database count is more.

Just execute the below script and paste the results appeared in message window to new query window and then press F5 to execute the scripts.

SELECT 'alter database ' + '' + NAME + ' ' + 'SET COMPATIBILITY_LEVEL = 100'
 ,recovery_model_desc
 ,compatibility_level
FROM sys.databases
WHERE compatibility_level = 90
 AND NAME NOT IN ('AdventureWorksDW')

Kindly note that you can also use the above script if you want to change the compatibility of the databases where you doesn't know the databases count or >100 databases at a time.


No comments:

Post a Comment