数据库项目中的 SQL70527 错误 [英] SQL70527 error in database project

查看:29
本文介绍了数据库项目中的 SQL70527 错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个基于现有数据库创建的数据库项目.它还添加了用于创建用户的脚本.其中一个脚本是 =>

I have a database-project, created based on my existing database. It also added the scripts for creating users. One of those scripts is =>

CREATE USER [JOOS_NT\Indigo.Development] FOR LOGIN [JOOS_NT\Indigo.Dev.svc];

这个脚本在我的数据库上运行良好.但是在我的数据库项目中,这个脚本在我构建时抛出了一个错误.错误是:

This script works fine on my database. But in my database-project this script is throwing an error when I build it. The error is:

"SQL70527: 'JOOS_NT\Indigo.Development' is not a valid name because it contains characters that are not valid."

[JOOS_NT\Indigo.Development] 中的\"似乎是不允许的.但是在数据库本身上我可以运行查询并且它工作正常.如果我将其更改为 [JOOS_NT/Indigo.Development] 我没有收到错误,但是当将项目中的脚本与现有数据库进行比较时,它会删除用户 ([JOOS_NT\Indigo.Development]) 并将其替换为 ([JOOS_NT/Indigo.Development])

It seems the "\" in the [JOOS_NT\Indigo.Development] is not allowed. However on the database itself I can run the query and it works fine. If I change it to [JOOS_NT/Indigo.Development] I don't get the error, but when comparing the scripts in the project to the existing database, it would drop the user ([JOOS_NT\Indigo.Development]) and replace it with ([JOOS_NT/Indigo.Development])

我错过了什么?

推荐答案

这是设计使然.核心问题是,在基于windows用户登录的CREATE USER FOR LOGIN"中,如果您使用的是用户的域名,那么这必须匹配登录的域名+登录名.请参阅此 在 MSDN 上发布

This is by design. The core issue is that in the "CREATE USER FOR LOGIN" based on a windows user login, if you are using a domain name for the user then this must match the login's domain name + login name. See this post on MSDN

这篇关于数据库项目中的 SQL70527 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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