;

How to Check a Database’s Compatibility Level in SQL Server


Tutorialsrack 04/11/2023 SQL SQL Server

In this article, you’ll learn how to check a database’s compatibility level in SQL Server. There are different ways to check the compatibility level of a database in SQL Server.

In SQL Server, to check the compatibility level of a database, you need to query any of these below-mentioned codes to know the compatibility levels of the database. Here's how you can do it:

Example 1: To Check Database Compatibility Using sys.databases View

Example 1: To Check Database Compatibility Using sys.databases View
SELECT name as 'Database Name', compatibility_level
FROM sys.databases
WHERE name = 'Employee';
Output

Database Name                         compatibility_level

------------------------              ------------------------------

Employee                              150

Example 2: To Check Database Compatibility Using system stored procedure sp_helpdb

Example 2: To Check Database Compatibility Using system stored procedure sp_helpdb
EXEC sp_helpdb Employee;

Example 3: To Check Database Compatibility Using  system stored procedure sp_dbcmptlevel

Example 3: To Check Database Compatibility Using  system stored procedure sp_dbcmptlevel
EXEC sp_dbcmptlevel Employee;
Output

The current compatibility level is 150.

I hope this article will help you to understand how to check a database’s compatibility level in SQL Server.

Share your valuable feedback, please post your comment at the bottom of this article. Thank you!


Related Posts



Comments

Recent Posts
Tags