To disable users of a Database in SQL Server 2008, I gave the command:
Use Database
Go
Revoke Connect from username;
It works for the users with SQL Server Authentication such as abcdef.
But not for the user with Windows Authentication such as DomainName\abcdef. It gives the error:
Msg 102, Level 15, State 1, Line 1 Incorrect syntax near '\'.
It does not even work by using the single quotes around the username in the above mentioned command.
Please suggest.
Open SSMS. Connect to a SQL Server instance. In Object Explorer, go to « Security » node then logins. Right-click on the SQL Server Login you want to drop then click on “Delete”
Use SQL Server Management StudioRight-click the database to change, and then select Properties. In the Database Properties dialog box, select the Options page. From the Restrict Access option, select Single. If other users are connected to the database, an Open Connections message will appear.
There are two ways of doing it: Right click on the database in Object Explorer go to Tasks > Detach. Select the Drop Connections checkbox.
After creating a user with “SQL User without Login” type, the user will have to login using their own credentials into SQL Server. It means that the user who is logged in will have his/her own username and password. Once the login is done in SQL Server, the user will be able to use the application.
It worked when I used the double quotes around the username such as:
USE Database
GO
REVOKE CONNECT FROM "domain\user"
To enable users of a database:
USE Database
GO
GRANT CONNECT TO "username"
To disable Logins of a server:
USE master
GO
ALTER LOGIN loginname DISABLE;
To enable Logins of a server:
USE master
GO
ALTER LOGIN loginname ENABLE;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With