I had two versions of SQLEXPRESS on my computer earlier ,now I have uninstalled 2012 SQLEXPRESS from my computer
Now when I try to attach .MDF file made in 2012 version it gives me error.

TITLE: Microsoft SQL Server Management Studio
------------------------------

Attach database failed for Server 'My-PC\SQLEXPRESS'.  (Microsoft.SqlServer.Smo)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1750.9+((dac_inplace_upgrade).101209-1051+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Attach+database+Server&LinkId=20476

------------------------------
ADDITIONAL INFORMATION:

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

------------------------------

The database 'C:\USERS\Fullpath\PAY.MDF' cannot be opened because it is version 706. This server supports version 655 and earlier. A downgrade path is not supported.
Could not open new database 'C:\USERS\Fullpath\PAY.MDF'. CREATE DATABASE is aborted. (Microsoft SQL Server, Error: 948)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=948&LinkId=20476

------------------------------
BUTTONS:

OK
------------------------------

Is there any way to do that without installing back the 2012 version ..Currently I'm running on 2008 version.

Thanks in advance.

Dani AI

Generated

Short answer: a database file created/used by a newer SQL Server engine cannot be opened by an older engine — there is no supported “downgrade” of the MDF format. As hinted, the practical workaround is to have both engines available and move data from the newer instance to the older one.

Practical paths (in order of simplicity):

  • Install SQL Server 2012 (Express is fine) and attach the MDF there — this is the quickest way to open the file.
  • Once attached on a 2012 instance, migrate to your 2008 instance by exporting the schema and data (use SSMS Generate Scripts targeted at SQL Server 2008, or use the Import/Export wizard, BCP, or SSIS for large tables).
  • If you cannot install 2012 locally, attach the MDF on another machine or VM running 2012 and push the data to your 2008 server (linked server, export/import, or scripted inserts).

Troubleshooting and cautions: do not copy an MDF from a running instance — work from a proper detach/backup or from a copy made while the DB was offline. Some 2012 features or types may not exist in 2008; expect manual adjustments for those objects. For large databases, avoid “script all data” (huge SQL files); use bulk export/import (BCP/SSIS) instead. Also be aware of identity columns, constraints and foreign keys — disable or drop/rehabilitate them appropriately during bulk load and re-enable afterward, and always validate the data post-migration.

Answer to : if the only artifact you have is that MDF created by 2012, then yes — you will need access to a 2012 (or later) engine to open it. After attaching on 2012 you can then export or transfer the schema/data to your 2008 instance using the methods above.

Recommended Answers

All 2 Replies

I may be no expert on the Microsoft sql server but a few things do appear obvious. One is that if you want the version 2008 to read the file then you will need to convert the file to a 2008 file aka the 655 or earlier datatype indicated in the error message. To do so I would emajine you would get both database engines accisible from the same system and retrieve records from one database while inserting into the older version. Note that this will most likely require a script weather it's php or some other language to process the results. But if it's possible to just upgrade the problem program it would probably be easier to do so.

So if I have to attach the file I have to re install 2012 version and then I can.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.