无法打开数据库,因为它是版本 851.此服务器支持版本 782 及更早版本.不支持降级路径 [英] The database cannot be opened because it is version 851. This server supports version 782 and earlier. A downgrade path is not supported

查看:76
本文介绍了无法打开数据库,因为它是版本 851.此服务器支持版本 782 及更早版本.不支持降级路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 SQL Server 中附加数据库文件.我收到以下错误.尝试从 Visual Studio 附加数据库时遇到同样的错误.我使用的是 Visual Studio 2013 和 SQL Server 2014 Management Studio.

我的连接字符串:

这里是在 Visual Studio 中设置的默认 SQL Server 实例.

解决方案

不能这样做 - 您不能从较新版本附加/分离或备份/恢复数据库> SQL Server 到旧版本 - 内部文件结构差异太大,无法支持向后兼容性.显然,您的数据库来自 SQL Server 2016 预发布版(内部版本:852),而您尝试将其附加到的引擎是 SQL Server 2014(内部版本:782).

你可以通过

来解决这个问题
  • 在所有机器上使用相同版本的 SQL Server - 然后您可以轻松地在实例之间备份/恢复数据库

  • 否则,您可以在 SQL Server Management Studio (Tasks >) 中为结构(表、视图、存储过程等)和内容(表中包含的实际数据)创建数据库脚本; 生成脚本) 或使用第三方工具

  • 或者您可以使用第三方工具,例如 Red-Gate 的 SQL 比较SQL 数据比较 在源和目标之间进行差异化",根据这些差异生成更新脚本,然后在目标平台上执行这些脚本;这适用于不同的 SQL Server 版本.

I am trying to attach database file in SQL Server. I am getting the below error. The same error I am getting while trying to attach database from Visual Studio. I am using Visual Studio 2013 and SQL Server 2014 Management Studio.

My connection string:

<add name="Sample"  
     connectionString="Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\M\Desktop\SampleApplication1\App_Data\Sample.mdf;Initial Catalog=SampleDBContext;Integrated Security=True;" 
     providerName="System.Data.SqlClient"/>

Error:

The database 'sample' cannot be opened because it is version 851. This server supports version 782 and earlier. A downgrade path is not supported. Could not open new database 'Sample'. CREATE DATABASE is aborted.

and here is the default SQL Server instance is set in Visual Studio.

解决方案

You CANNOT do this - you cannot attach/detach or backup/restore a database from a newer version of SQL Server down to an older version - the internal file structures are just too different to support backwards compatibility. Obviously, your database is from a SQL Server 2016 pre-release (internal version: 852) while the engine you're trying to attach it to is SQL Server 2014 (internal version: 782).

You can either get around this problem by

  • using the same version of SQL Server on all your machines - then you can easily backup/restore databases between instances

  • otherwise you can create the database scripts for both structure (tables, view, stored procedures etc.) and for contents (the actual data contained in the tables) either in SQL Server Management Studio (Tasks > Generate Scripts) or using a third-party tool

  • or you can use a third-party tool like Red-Gate's SQL Compare and SQL Data Compare to do "diffing" between your source and target, generate update scripts from those differences, and then execute those scripts on the target platform; this works across different SQL Server versions.

这篇关于无法打开数据库,因为它是版本 851.此服务器支持版本 782 及更早版本.不支持降级路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆