Cannot set SQL 2005 database to compatability level 80

Hi

Hoping someone can help. Due to old compiled code I am not able to amend a SQL query that wont run on SQL 2005+ (its currently working fine on SQL 2000 but the server and SQL needs to go :) )

I need to get compatibility mode to 80;

I've tried the following which returns an error saying the levels are only 90 upwards, any ideas please?

Neil

I've tried:
ALTER DATABASE corporate
SET COMPATABILITY_LEVEL = 80
GO

Open in new window


message returned:
Msg 15048, Level 16, State 1, Line 3
Valid values of the database compatability level are 90, 100 or 110

Open in new window

LVL 3
Neil ThompsonSenior Systems DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Steve WalesSenior Database AdministratorCommented:
Since the error message is telling you you can go up to 110, that tells me you're running SQL 2012.

You can't set compatibility level to 80 in SQL 2012, it's just not supported.

See the matrix of what is supported here: https://msdn.microsoft.com/en-us/library/bb510680.aspx

Time to rewrite that code.
0
Vikas GargBusiness Intelligence DeveloperCommented:
Hello,

The best practice to change the compatibility level of database is in following three steps.

    Set the database to single user access mode by using
    ALTER DATABASE SET SINGLE_USER
    Change the compatibility level of the database.
    Put the database in multiuser access mode by using
    ALTER DATABASE SET MULTI_USER


Please note - A database containing an indexed view cannot be changed to a compatibility level lower than 80.

----SQL Server 2005 database compatible level to SQL Server 2000
EXEC sp_dbcmptlevel AdventureWorks, 80;
GO
0
Neil ThompsonSenior Systems DeveloperAuthor Commented:
Thanks Guys,

Database is definitely 2005
SQL About
I've tried Vikas's code but still get this:
Error
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Steve WalesSenior Database AdministratorCommented:
What that is showing is that your TOOLS are 2005.  Doesn't necessarily mean that the database is.   I just tried that internally.  Connected to a 2008R2 DB using tools for SQL 2005.   Help/About showed 2005, but this query below returned 10.50.2550 - showing that I used 2005 SSMS to connect to 2008 R2 database.

Execute this query:  select @@VERSION;

What do you get back ?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Neil ThompsonSenior Systems DeveloperAuthor Commented:
Thanks Steve,  2012 :(

User error, we were connecting via the 2005 server to a 2012 version, rather than the same server's 2005 copy

Stupid mistake, caught by your question.

Thanks
Neil
0
Neil ThompsonSenior Systems DeveloperAuthor Commented:
Great comments, thanks for the "how to", and the "why it wasn't working" ideas
Neil
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.