Tuesday 6 February 2024

Changing Sql Server Compatibility Level

The compatibility level for a database can be changed very easily using the ALTER DATABASE statement. Here is the basic syntax:

ALTER DATABASE database_name SET COMPATIBILITY_LEVEL = version;

For example, to change a database named ‘devdb’ to the SQL Server 2022 compatibility level:

ALTER DATABASE devdb SET COMPATIBILITY_LEVEL = 160;