views:

1036

answers:

2

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?

+4  A: 
select compatibility_level from sys.databases where name=db_name()
Nick Kavadias
@Nick bingo! Wow, sys.databases exposes so much other information! Thanks
Sung Meister
+2  A: 
select compatibility_level from sys.databases where name ='myDB'
mjv
+1 Ah... few minutes late.. But thank you @mjv
Sung Meister