A DBA friend of mine came across a strange problem the other day. He discovered that one of the users in a SQL server database was disabled, thats a database user not a server login. At least we thought it was disabled at first, it behaved as if it was disabled and it had the small red down arrow icon that disabled server logins have, but as we all know there is no way to enable or disable database users in the Management Studio GUI.

After some more research, it turns out that the user didnt have
CONNECT
permissions to the database (which I guess amounts to the same as being disabled). You can grant
CONNECT
permissions using the code:USE YourDatabase GRANT CONNECT TO User1 |
USE YourDatabase REVOKE CONNECT FROM User1 |
USE DBName
go SELECT name , hasdbaccess FROM sys.sysusers WHERE name = 'User1' |