Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Administration
 How to check compatibility level

Author  Topic 

vijays3
Constraint Violating Yak Guru

354 Posts

Posted - 2010-04-29 : 07:38:39


Hi all

could you please tell me how to check compatibility level using

DATABASEPROPERTYEX ( database , property ) this function.

I need to check my database comp level using this function only.

Please let me know.

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-04-29 : 07:56:36
That function doesn't expose the compatability level. Why do you say you want to use that function only?

Depending on the version of SQL...
SQL 2000: SELECT name, cmptlevel FROM sysdatabases
SQL 2005/2008 SELECT name, compatibility_level FROM sys.databases

--
Gail Shaw
SQL Server MVP
Go to Top of Page

vijays3
Constraint Violating Yak Guru

354 Posts

Posted - 2010-04-29 : 08:00:49
Thanks for your reply ,but i want to use only databasepropertyex function to get it



quote:
Originally posted by GilaMonster

That function doesn't expose the compatability level. Why do you say you want to use that function only?

Depending on the version of SQL...
SQL 2000: SELECT name, cmptlevel FROM sysdatabases
SQL 2005/2008 SELECT name, compatibility_level FROM sys.databases

--
Gail Shaw
SQL Server MVP

Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-04-29 : 08:43:48
You can't use DatabasePropertyEx. There's no property available in that function to return the compatibility level of a database. The compatibility level is returned from the two system views that I indicated earlier, not from DatabasePropertyEx

--
Gail Shaw
SQL Server MVP
Go to Top of Page

tosscrosby
Aged Yak Warrior

676 Posts

Posted - 2010-04-30 : 11:43:19
Here is a list of all functions with SQL2005:
http://msdn.microsoft.com/en-us/library/ms174318(v=SQL.90).aspx

There is also one for 2000 (I'm sure for 2008 as well if you google it):
http://msdn.microsoft.com/en-us/library/aa258899(SQL.80).aspx

I didn't find any that returned compatability level but I only did a cursory check of the topics.

Terry

-- The problem with socialism is that you eventually run out of other people’s money. -- Margaret Thatcher
Go to Top of Page
   

- Advertisement -