SQL Server conversion

I have the following script and please review the error message.  Currently, I have SQL Server 2012, and I believe the database_data.mdf is older version.
How can fix it in this case? Thanks

EXEC sp_attach_db
  @filename1= 'C:\MCE\MsSqlData\database_data.mdf',
  @filename2= 'C:\MCE\MsSqlData\database_log.ldf'

EXEC sp_addlogin 'databasename', 'password', 'databasename'

USE databasename
EXEC sp_changedbowner databasename

Error message:

Msg 950, Level 20, State 1, Line 1
Database 'databasename' cannot be upgraded because its non-release version (539) is not supported by this version of SQL Server.
You cannot open a database that is incompatible with this version of sqlservr.exe. You must re-create the database.
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.

The easiest think you can do is to make a backup in your older database instance and then restore it into SQL Server 2012
PadawanDBAOperational DBACommented:
You're going to have to make multiple jumps for upgrading this database.  The upgrade path to SQL Server 2012 only supports SQL Server 2005 SP2 on up.  What that means is you're going to have to make a pitstop and restore to a SQL Server 2005 SP2/2008/2008r2 version of SQL Server, back it up from that server and then restore that upgraded backup to SQL Server 2012.  This article has some good detail: http://blogs.technet.com/b/mdegre/archive/2012/06/15/migration-sql-server-2000-to-sql-server-2012.aspx.
David ToddSenior DBACommented:

Do you know which version this originated from?

You can take a backup or database forward two versions 2000 -> 2008, 2005 -> 2012, but 2000 /=> 2012!

The solution is to find an intermediate version - in this case either 2005, 2008, 2008r2, and attach the database or restore the backup to, then take another backup.


PS I suggest using the backup to do this, otherwise there is no rollback if you've trashed the mdf/ldf files.
PadawanDBAOperational DBACommented:
I forgot to mention that it looks to be SQL Server 2000 from what I can find: http://social.technet.microsoft.com/wiki/contents/articles/10233.microsoft-sql-server-error-950.aspx.  Dtodd makes an excellent recommendation with doing this from a backup.  Or at the very least, make copies of the data files just in case.
Eugene ZCommented:
on what sql server version this db lives now?
what is compatibility mode set

if it is sql 2005+
and  db has compatibility mode 2000
try to set it to 2005+
if the mdf\ldf file are not attached
try to attach to 2005-2008 sql server
and check compatibility mode
there could be some another elements preventing this db to be upgraded


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
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 2008

From novice to tech pro — start learning today.