Ad

The Database Cannot Be Opened Because It Is Version 706

- 1 answer

I have the problem that I am using Visual Studio 2013 to create a MDF file and then open it like it is described in this tutorial:

creating-the-membership-schema-in-sql-server

But when I try to attach the database to the MSSQLServer I get error 948 which basicly says:

The database cannot be opened because it is version 706. This server supports version 663 and earlier.

I have read these two articles:

The database cannot be opened because it is version 782. This server supports version 706 and earlier. A downgrade path is not supported

The database cannot be opened because it is version 706. (ASP.net)

From this is assume that it is possible to switch "Visual Studio" to a different SQL Server Version. So I could delete my old file, create a new one (In vS2013 ) and then attach it to my SQlServerExpress.

Could I switch under

Tools-> Options -> Database Tools -> Data Connections

to SQL version (LocalDB)\v10.0 ? And if so are there any reasons to not switch because it could lead to errors or unexpected behavior in VS2013

Ad

Answer

When you create a database, you can specify the compatibility version. This turns off features that would be available in a newer version of SQL Server, but it is unlikely that you would be using those if you just have a database for authentication.

It appears that only SQL Server Express version 2008 R2 (with some patches applied) in your problem server. To create your database in a compatible version, you have to go through many steps (full article):

  • Backup your current database
  • In the Database Manager, right click and choose the "Generate Scripts" task:
    • Script entire database
    • Save to file and choose your destination path, choose Unicode text file
    • Select the following advanced options:
    • Script for Server Version: SQL Server 2008 R2
    • Types of data to script: schema and data
    • Script Foreign Keys: true
    • Script Indexes: true
  • Connect to a SQL Server 2008 R2 instance (important)
  • Run the scripts you generated to recreate the database and data in the downgraded version (you may have to correct the database name in the top of the script)
  • Take the generated MDF file and incorporate it in your application

A newer database can work with an older MDF file (within reason, Server 2012 won't go further back than 2008), but it won't be able to create an MDF file that is compatible with an older version.

Ad
source: stackoverflow.com
Ad