Thundercleez
Thundercleez

Reputation: 401

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.

I'm trying to find out the SQL statement that I can use to remove one of those users (I need an automated solution).

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

Incorrect syntax near 'BUILTIN\Users'

and the delete throws

Ad hoc updates to system catalogs are not allowed

Upvotes: 0

Views: 233

Answers (1)

SQLChao
SQLChao

Reputation: 7837

Don't use the quotes but brackets instead.

DROP LOGIN [BUILTIN\Users]

Upvotes: 1

Related Questions