如何在Visual Studio 2015中使用SQL Server 2016? [英] How to use SQL server 2016 in visual studio 2015?

查看:517
本文介绍了如何在Visual Studio 2015中使用SQL Server 2016?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试从visual Studio 2015连接到此文件时,我有数据库文件ex.mdf我收到错误消息错误:此服务器支持版本782及更早版本。降级路径不是支持。





我的尝试:



因此我尝试为在sqlserver 2016中创建的数据库文件安装ssdt工具。即使在安装之后仍然使用sqlserver2014,我如何将我的visual studio2015指向sqlserver2016。 / pre> 

解决方案

这不是Visual Studio的问题:它是创建数据库文件的SQL版本。

打开SSMS,然后打开一个新的查询窗口。

输入查询:

  DBCC  CHECKPRIMARYFILE('  PathToDataBaseFile' 2 

并执行它。例如:

  DBCC  CHECKPRIMARYFILE('  D:\Database Backups \SM_XRVCB.mdf' 2 

您得到的答复包括版本号:

属性值
数据库名称SM_XRVCB
数据库版本706
排序规则53256

在这种情况下,该文件是使用V706创建的,即SQL Server 2012:

 SQL Server版本内部数据库版本
SQL Server 2016 852
SQL Server 2014 782
SQL Server 2012 706
SQL Server 2008 R2 660/661
SQL Server 2008 655
SQL Server 2005 611/612
SQL Server 2000 539
SQL Server 7 515

因此,如果您的错误是说V782,那么它是SQL Server 2014,并且DB文件的版本号不能高于782.
然后查看您要连接的实例(查看您的代码正在使用的连接字符串)并找出该服务器的SQL版本(这很简单, SELECT @@ VERSION 将会这样做!)。您需要在正确的服务器上指向该连接字符串:I.e。 2016年或之后以打开文件。


I have database file ex.mdf when i tried to connect to this file from the visual Studio 2015 i get error message saying "Error: This server supports version 782 and earlier. A downgrade path is not supported."



What I have tried:

Hence i tried to install the ssdt tools for the database file which is created in the sqlserver 2016. Even after installing it is still using the sqlserver2014 how do i point my visual studio2015 to sqlserver2016.

解决方案

It's not Visual studio that's the problem: it's the version of SQL that teh DB file was created with.
Open SSMS, and open a new query window.
Enter the query:

DBCC CHECKPRIMARYFILE('PathToDataBaseFile',2)

And execute it. For example:

DBCC CHECKPRIMARYFILE('D:\Database Backups\SM_XRVCB.mdf',2)

The response you get includes the version number:

property           value
Database name      SM_XRVCB
Database version   706
Collation          53256

In this case, the file was created with V706, which is SQL Server 2012:

SQL Server Version	Internal Database Version
SQL Server 2016         852
SQL Server 2014         782
SQL Server 2012         706
SQL Server 2008 R2      660/661
SQL Server 2008         655
SQL Server 2005         611/612
SQL Server 2000         539
SQL Server 7            515

So if your error is saying V782, then it's SQL Server 2014, and the version number of the DB file cannot be higher than 782.
Then look at the instance you are connecting to (look at the connection string your code is using) and find out what version of SQL that server is (that's simple, SELECT @@VERSION will do it!). You need to point that connection string at the right server: I.e. 2016 or later in order to open the file.


这篇关于如何在Visual Studio 2015中使用SQL Server 2016?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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