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?
Eugene ZConnect With a Mentor Commented:
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

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

All Courses

From novice to tech pro — start learning today.