Disable users of a database not Logins in SQL server 2008 Disable users of a database not Logins in SQL server 2008 sql-server sql-server

Disable users of a database not Logins in SQL server 2008


It worked when I used the double quotes around the username such as:

USE DatabaseGOREVOKE CONNECT FROM "domain\user"

To enable users of a database:

USE DatabaseGOGRANT CONNECT TO "username"

To disable Logins of a server:

USE masterGOALTER LOGIN loginname DISABLE;

To enable Logins of a server:

USE masterGOALTER LOGIN loginname ENABLE;


I identify the disabled users by using the sys.sysusers DMV

you can see on the example below. the result of the query, and further below, navigating through ssms.

select * from sys.sysusers where islogin =1  and hasdbaccess = 0

enter image description here

enter image description here