notebook/IT/SQL/SCRIPTS SQL QSA ORSYS/divergence de collation.sql
2020-11-26 18:38:25 +01:00

12 lines
506 B
SQL

-- connaitre les bases ayant une collation différente de celle du serveur
SELECT name, collation_name, SERVERPROPERTY('Collation') AS Server_collation
FROM sys.databases
WHERE collation_name <> SERVERPROPERTY('Collation')
-- bases ayant un AUTO close ou AUTO shrink
SELECT name, N'ALTER DATABASE [' + name + '] SET AUTO_CLOSE OFF;ALTER DATABASE [' + name + '] SET AUTO_SHRINK OFF;'
FROM sys.databases
WHERE database_id > 4
AND (is_auto_shrink_on = 1
OR is_auto_close_on = 1);