In this article, you’ll learn how to change the compatibility level of a database in SQL Server.
In SQL Server, to change the compatibility level of a database in SQL Server, you can use the
ALTER DATABASE statement. The compatibility level determines which version of SQL Server the database should emulate for query optimization and certain behaviors. Here's how you can change the compatibility level:
USE YourDatabaseName; -- Replace with your database name -- Change the compatibility level to a specific version ALTER DATABASE YourDatabaseName SET COMPATIBILITY_LEVEL = 140; -- Replace with the desired compatibility level (e.g., 100, 110, 120, 130, 140, 150, etc.)
Here are some common compatibility level values and the SQL Server versions they correspond to:
I hope this article will help you to understand how to change the compatibility level of a database in SQL Server.
Share your valuable feedback, please post your comment at the bottom of this article. Thank you!