How to check SQL Server Database compatibility after sp_dbcmptlevel is deprecated?

Viewed 63683

According to BOL (SQL Server Books Online) on sp_dbcmptlevel,

This feature will be removed in a future version of Microsoft SQL Server. Do not use this feature in new development work, and modify applications that currently use this feature as soon as possible. Use ALTER DATABASE Compatibility Level instead.

Now, the only TSQL way I know of checking database compatibility is through sp_dbcmptlevel. As far as I know, ALTER DATABASE Compatibility Level is just for setting the compatibility level, not getting info.

How should one to get compatibility level without using GUI?

5 Answers

How to check SQL Server Database compatibility


       SELECT compatibility_level  as [Current compatibility_level] FROM
         sys.databases WHERE name = 'Database Name';

Related