简体   繁体   English

如何从SQL Server 2014中删除用户?

[英]How to remove a user from SQL Server 2014?

If I open SQL Server 2014 Management Studio GUI and connect to my database, I can expand the database > Security > Logins to see the list of users that can login. 如果我打开SQL Server 2014 Management Studio GUI并连接到数据库,则可以展开数据库>安全>登录以查看可以登录的用户列表。

I'm trying to find out the SQL statement that I can use to remove one of those users (I need an automated solution). 我正在尝试找出可用于删除其中一个用户的SQL语句(我需要一个自动化的解决方案)。

I've tried 我试过了

drop login 'BUILTIN\Users'

delete from master..syslogins where loginname = 'BUILTIN\Users'

drop user 'BUILTIN\Users'

from the drop commands, I get the error 从drop命令,我得到了错误

Incorrect syntax near 'BUILTIN\\Users' “ BUILTIN \\ Users”附近的语法不正确

and the delete throws 和删除引发

Ad hoc updates to system catalogs are not allowed 不允许对系统目录进行临时更新

不要使用引号,而是使用括号。

DROP LOGIN [BUILTIN\Users]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM