Sql-server – SQL Server 2008 R2 Express: MDF file not attached in SQL Server 2008 Developer

sql serversql-server-2008-r2

I use this command on both express and developer addition

select @@VERSION

Express server result is below

Microsoft SQL Server 2008 R2 (RTM) - 10.50.1617.0 (Intel X86)
    Apr 22 2011 11:57:00
    Copyright (c) Microsoft Corporation
    Express Edition with Advanced Services on Windows NT 5.1 <X86> (Build 2600: Service Pack 3)

and developer result is blow

Microsoft SQL Server 2008 (RTM) - 10.0.1600.22 (Intel X86)   
Jul  9 2008 14:43:34   Copyright (c) 1988-2008 Microsoft Corporation  Developer Edition on Windows NT 5.1 <X86> (Build 2600: Service Pack 3) 

When I try to attach the MDF file from my Express edition to my developer edition, I get this error:

An exception occurred while executing a
transact sql statement or batch the
database 'example' cannot be opened
because it is version 661. This
server supports version 655. A
downgrade path is not supported could
not open new database 'example' create
database is aborted. Microsoft Server,
Error: 948

Best Answer

Since your version of Express is newer than your version of Developer, you will not be able to migrate directly, but you have a few options, in my order of preference:

  1. Upgrade to SQL Server 2008 R2 Developer Edition - by far the simplest approach
  2. Use a third party product to replicate schema and then the data (e.g. Red Gate SQL Compare / SQL Data Compare - I blogged about several other options here).
  3. Use a manual script, such as this one from Jonathan Kehayias
  4. Use the import-export wizard from Developer Edition to pull the data/schema from Express