Visual Studio 2010 - 导入数据库的数据库项目无法构建 [英] Visual Studio 2010 - Database Project with imported database fails to build

查看:42
本文介绍了Visual Studio 2010 - 导入数据库的数据库项目无法构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在查看 VS2010 中的数据库项目,这个想法是我想要一些可以用来跟踪数据库架构(在源代码控制中)以及生成新安装"脚本和更改脚本的能力.

I'm looking at the Database Project in VS2010, the idea being that I want something I can use to keep track of the database schema (in source control) and the ability to generate "new install" scripts, and change scripts.

当我创建一个新的数据库项目向导并导入我现有的数据库架构时,它不会构建".我收到错误:

When I create a new database project wizard and import my existing database schema, it won't "build". I get the error:

SQL03006:用户:[scanner] 有一个未解析的登录引用[扫描仪].

SQL03006: User: [scanner] has an unresolved reference to Login [scanner].

产生此错误的 SQL:

The SQL that generates this error:

创建用户 [扫描仪] 用于登录[扫描仪];

CREATE USER [scanner] FOR LOGIN [scanner];

用户scanner"是我导入的数据库中定义的登录名.我不知道它在告诉我什么,而且谷歌并没有抛出太多.有什么想法吗?

The user "scanner" is a login defined in the database I imported. I have no idea what it's teling me, and google isn't throwing much up. Any ideas?

推荐答案

Login 实际上是在服务器安装的 master 数据库中定义的.CREATE USER 语句需要指向现有的登录名,否则会出错.数据库项目不知道服务器级别的登录.您可以创建一个服务器项目来处理登录,或者您可以关闭对数据库项目中的安全对象的检查.有关详细信息,请参阅 Demetri M 的回答:http://social.msdn.microsoft.com/Forums/eu/vstsdb/thread/1f8226fe-b791-4344-8735-3d38307e8664

The Login is actually defined in the master database of the server install. The CREATE USER statement needs to point at an existing Login otherwise it errors. The Database Project is not aware of the Login at the server level. Either you can create a Server Project to handle the Logins, or you can turn off the checking of Security objects in your Database Project. See the answer by Demetri M for more details: http://social.msdn.microsoft.com/Forums/eu/vstsdb/thread/1f8226fe-b791-4344-8735-3d38307e8664

这篇关于Visual Studio 2010 - 导入数据库的数据库项目无法构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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