Check the compatibility level of the database in SQL Server

Check and change the compatibility level of the database in the SQL Server

Check the compatibility level for the Database

SELECT compatibility_level FROM sys.databases WHERE name ='AdventureWorks2019';

Check the compatibility level for all the databases:

SELECT name,compatibility_level FROM sys.databases

name	compatibility_level
master	140
tempdb	140
model	140
msdb	140
TEST	140
AdventureWorks2017	140
AdventureWorks2022	140
TESTNEW	140
Project	140

Change the compatibility level as :

ALTER DATABASE TESTNEW SET COMPATIBILITY_LEVEL = 130; 

Chart of compatibility level:

ProductDefault Compatibility LevelSupported Compatibility Level
SQL Server 2019 (15.x)150150, 140, 130, 120, 110, 100
SQL Server 2017 (14.x)140140, 130, 120, 110, 100
SQL Server 2016 (13.x)130130, 120, 110, 100
SQL Server 2014 (12.x)120120, 110, 100
SQL Server 2012 (11.x)110110, 100, 90
SQL Server 2008 R2100100, 90, 80
Azure SQL Database150150, 140, 130, 120, 110, 100

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.